1
0
Fork 0

Render hashtag links with data-mention="hashtag" attribute

This commit is contained in:
Christof Dorner 2023-02-18 00:18:32 +01:00
parent 276b255f32
commit f3334b1550
5 changed files with 13 additions and 7 deletions

View file

@ -62,7 +62,7 @@ class Note(ActivityObject):
changed_content = False
for hashtag in instance.mention_hashtags.all():
updated_content = re.sub(
rf'(<a href=")[^"]*/hashtag/[^"]*(">{hashtag.name}</a>)',
rf'(<a href=")[^"]*(" data-mention="hashtag">{hashtag.name}</a>)',
rf"\1{hashtag.remote_id}\2",
instance.content,
)