stream notifications: Add helper for silent user mention syntax.

In many of our stream notification messages, we make use of the
same silent user mention syntax, the template for which was always
hardcoded. This commit adds a helper function that all relevant
callers can call to get the right syntax when mentioning users.

Thanks to Tim Abbott for this suggestion!
This commit is contained in:
Eeshan Garg
2021-12-07 15:41:45 -05:00
committed by Tim Abbott
parent 8ebe05f644
commit 3714a30e63
3 changed files with 13 additions and 8 deletions

View File

@@ -152,3 +152,7 @@ def get_stream_name_info(realm: Realm, stream_names: Set[str]) -> Dict[str, Full
dct = {row["name"]: row for row in rows}
return dct
def silent_mention_syntax_for_user(user_profile: UserProfile) -> str:
return f"@_**{user_profile.full_name}|{user_profile.id}**"