1
0
Fork 0

Enable finding existing hashtags case-insensitive

We should store hashtags case-sensitive, but ensures that an existing
hashtag with different case are found and re-used. for example,
an existing #BookWyrm hashtag will be found and used even if the
status content is using #bookwyrm.
This commit is contained in:
Christof Dorner 2023-02-21 17:17:53 +01:00
parent f3334b1550
commit 9ca9883e0b
4 changed files with 41 additions and 27 deletions

View file

@ -65,6 +65,7 @@ class Note(ActivityObject):
rf'(<a href=")[^"]*(" data-mention="hashtag">{hashtag.name}</a>)',
rf"\1{hashtag.remote_id}\2",
instance.content,
flags=re.IGNORECASE,
)
if instance.content != updated_content:
instance.content = updated_content