Repository: zulip/zulip-terminal

Issue:
Render @topic wildcard mentions correctly when displayed in a message feed.
[CZO discussion](https://chat.zulip.org/#narrow/stream/378-api-design/topic/.40topic-mention.20data-user-id.20.2326195/near/1605762)

For stream wildcard mentions (all, everyone, stream), the rendered content is:
```
<span class="user-mention" data-user-id="*">@{stream_wildcard}</span>
```
As a part of the @topic wildcard mentions project ( [#22829](https://github.com/zulip/zulip/issues/22829) ) , we have introduced `@topic`; the rendered content is:
```
<span class="topic-mention">@{topic_wildcard}</span>
```

Since we are not using `user-mention` class (and data-user-id="*" attribute), the `@topic` mention is not rendered correctly.

[#26195 (comment)](https://github.com/zulip/zulip/pull/26195)

Discussion:
neiljp: @naman2003now Thanks for turning your comment in #1418 into this PR :+1:

This looks great - I updated the comment and commit text slightly, and will merge what is here shortly :)

Patch:
diff --git a/zulipterminal/ui_tools/messages.py b/zulipterminal/ui_tools/messages.py
index 1598306..1a9bb9d 100644
--- a/zulipterminal/ui_tools/messages.py
+++ b/zulipterminal/ui_tools/messages.py
@@ -442,9 +442,10 @@ class MessageBox(urwid.Pile):
 
                 markup.append(("msg_math", tag_text))
             elif tag == "span" and (
-                {"user-group-mention", "user-mention"} & set(tag_classes)
+                {"user-group-mention", "user-mention", "topic-mention"}
+                & set(tag_classes)
             ):
-                # USER MENTIONS & USER-GROUP MENTIONS
+                # USER, USER-GROUP & TOPIC MENTIONS
                 markup.append(("msg_mention", tag_text))
             elif tag == "a":
                 # LINKS


Test patch:
diff --git a/tests/ui_tools/test_messages.py b/tests/ui_tools/test_messages.py
index f56da14..d4d9e80 100644
--- a/tests/ui_tools/test_messages.py
+++ b/tests/ui_tools/test_messages.py
@@ -114,6 +114,11 @@ class TestMessageBox:
                 [("msg_mention", "@A Group")],
                 id="group-mention",
             ),
+            case(
+                '<span class="topic-mention">@topic',
+                [("msg_mention", "@topic")],
+                id="topic-mention",
+            ),
             case("<code>some code", [("pygments:w", "some code")], id="inline-code"),
             case(
                 '<div class="codehilite" data-code-language="python">'