From 31dc08ad0dfe7c0b5e8491b30b9dab415d44210d Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 15 Dec 2022 17:00:00 -0700 Subject: [PATCH] Add hashtags to post objects --- activities/models/post.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/activities/models/post.py b/activities/models/post.py index 599a1ea..d31b52c 100644 --- a/activities/models/post.py +++ b/activities/models/post.py @@ -537,6 +537,15 @@ class Post(StatorModel): for mention in self.mentions.all(): value["tag"].append(mention.to_ap_tag()) value["cc"].append(mention.actor_uri) + # Hashtags + for hashtag in self.hashtags or []: + value["tag"].append( + { + "href": f"https://{self.author.domain.uri_domain}/tags/{hashtag}/", + "name": f"#{hashtag}", + "type": "as:Hashtag", + } + ) # Emoji for emoji in self.emojis.all(): value["tag"].append(emoji.to_ap_tag())