diff options
-rw-r--r-- | activities/models/hashtag.py | 2 | ||||
-rw-r--r-- | tests/activities/models/test_hashtag.py | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/activities/models/hashtag.py b/activities/models/hashtag.py index 9cfb21d..b7f0832 100644 --- a/activities/models/hashtag.py +++ b/activities/models/hashtag.py @@ -176,7 +176,7 @@ class Hashtag(StatorModel): leading '#'. """ hashtag_hits = cls.hashtag_regex.findall(strip_html(content)) - hashtags = sorted({tag[1].lower() for tag in hashtag_hits}) + hashtags = sorted({tag.lower() for tag in hashtag_hits}) return list(hashtags) @classmethod diff --git a/tests/activities/models/test_hashtag.py b/tests/activities/models/test_hashtag.py index 32742d6..91af45c 100644 --- a/tests/activities/models/test_hashtag.py +++ b/tests/activities/models/test_hashtag.py @@ -9,11 +9,13 @@ def test_hashtag_from_content(): "with", ] assert Hashtag.hashtags_from_content("#hashtag.") == ["hashtag"] - assert Hashtag.hashtags_from_content("More text\n#one # two ##three #hashtag;") == [ + assert Hashtag.hashtags_from_content("More text\n#one # two ##three #hashtag!") == [ "hashtag", "one", "three", ] + assert Hashtag.hashtags_from_content("my #html loves   entities") == ["html"] + assert Hashtag.hashtags_from_content("<span class='hash'>#</span>tag") == ["tag"] def test_linkify_hashtag(): |