diff --git a/activitypub.py b/activitypub.py
index 68d21c7..312310f 100644
--- a/activitypub.py
+++ b/activitypub.py
@@ -736,6 +736,8 @@ def postprocess_as2(activity, orig_obj=None, wrap=True):
if not name.startswith('#'):
tag['name'] = f'#{name}'
+ as2.link_tags(obj_or_activity)
+
# language, in contentMap
# https://github.com/snarfed/bridgy-fed/issues/681
if content := obj_or_activity.get('content'):
diff --git a/tests/test_activitypub.py b/tests/test_activitypub.py
index e87dd77..d813f5f 100644
--- a/tests/test_activitypub.py
+++ b/tests/test_activitypub.py
@@ -2011,6 +2011,36 @@ class ActivityPubUtilsTest(TestCase):
],
}))
+ def test_postprocess_as2_plain_text_content_links_hashtags_mentions(self):
+ expected = 'foo @bar #baz'
+ self.assert_equals({
+ 'content': expected,
+ 'contentMap': {'en': expected},
+ 'content_is_html': True,
+ 'tag': [{
+ 'type': 'Tag',
+ 'href': 'http://inst/bar',
+ }, {
+ 'type': 'Mention',
+ 'href': 'http://inst/baz',
+ }],
+ 'to': [as2.PUBLIC_AUDIENCE],
+ 'cc': ['http://inst/baz'],
+ }, postprocess_as2({
+ 'content': 'foo @bar #baz',
+ 'tag': [{
+ 'type': 'Tag',
+ 'href': 'http://inst/bar',
+ 'startIndex': 4,
+ 'length': 4,
+ }, {
+ 'type': 'Mention',
+ 'href': 'http://inst/baz',
+ 'startIndex': 9,
+ 'length': 4,
+ }],
+ }))
+
def test_postprocess_as2_strips_link_attachment(self):
self.assertNotIn('attachment', postprocess_as2({
'type': 'Note',