summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorAndrew Godwin2022-12-16 20:04:28 -0700
committerAndrew Godwin2022-12-16 20:04:28 -0700
commite5b76c120e27bad7c6e4ec323ffc2e65d7dfb654 (patch)
treeafe144887bb1a0613c463fe3024f5cd9665028c1 /users
parent4a28e1708e1cd6d9cbbfe41d94ff9d7f646f6c94 (diff)
downloadtakahe-e5b76c120e27bad7c6e4ec323ffc2e65d7dfb654.tar.gz
takahe-e5b76c120e27bad7c6e4ec323ffc2e65d7dfb654.tar.bz2
takahe-e5b76c120e27bad7c6e4ec323ffc2e65d7dfb654.zip
Fetch emoji for user profiles
Diffstat (limited to 'users')
-rw-r--r--users/models/identity.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/users/models/identity.py b/users/models/identity.py
index 9462fee..a1167e5 100644
--- a/users/models/identity.py
+++ b/users/models/identity.py
@@ -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)()