Fetch emoji for user profiles

This commit is contained in:
Andrew Godwin 2022-12-16 20:04:28 -07:00
parent 4a28e1708e
commit e5b76c120e
3 changed files with 13 additions and 2 deletions

View File

@ -225,7 +225,7 @@ class Config(models.Model):
hashtag_unreviewed_are_public: bool = True
hashtag_stats_max_age: int = 60 * 60
emoji_unreviewed_are_public: bool = False
emoji_unreviewed_are_public: bool = True
cache_timeout_page_default: int = 60
cache_timeout_page_timeline: int = 60 * 3

View File

@ -341,6 +341,10 @@ body.no-sidebar .right-column {
text-transform: uppercase;
}
img.emoji {
height: 0.8em;
}
/* Icon menus */
.icon-menu .option {
@ -377,7 +381,7 @@ body.no-sidebar .right-column {
}
.icon-menu .option img.emoji {
height: 22px;
height: 20px;
}
.icon-menu .option i {

View File

@ -429,6 +429,8 @@ class Identity(StatorModel):
Fetches the user's actor information, as well as their domain from
webfinger if it's available.
"""
from activities.models import Emoji
if self.local:
raise ValueError("Cannot fetch local identities")
try:
@ -501,6 +503,11 @@ class Identity(StatorModel):
self.domain = await get_domain(actor_url_parts.hostname)
else:
self.domain = await get_domain(actor_url_parts.hostname)
# Emojis (we need the domain so we do them here)
for tag in get_list(document, "tag"):
if tag["type"].lower() == "toot:emoji":
await sync_to_async(Emoji.by_ap_tag)(self.domain, tag, create=True)
# Mark as fetched
self.fetched = timezone.now()
try:
await sync_to_async(self.save)()