markdown: Fix #-mention of private channel's topic made by system bots.

Previously when system bots used to `#-mention` a private
channel's topics in cases like moving messages of a private
channel, then the #-mentions were not rendered by the
markdown. This was because the system bots did not have
authorization to mention these channels.

This is fixed by passing down an `acting_user` parameter
in code paths involving sending these move message
notifications so that permission of acting_user to mention
the topic is verified for rendering the markdown, rather
than that of the system bot.
This commit is contained in:
roanster007
2025-02-12 21:04:26 +05:30
committed by Tim Abbott
parent a2dd84541d
commit 4789de2e96
5 changed files with 63 additions and 12 deletions

View File

@@ -423,16 +423,12 @@ class MentionData:
def get_stream_name_map(
self, stream_names: set[str], acting_user: UserProfile | None
) -> dict[str, int]:
return self.mention_backend.get_stream_name_map(
stream_names, acting_user=self.message_sender
)
return self.mention_backend.get_stream_name_map(stream_names, acting_user=acting_user)
def get_topic_info_map(
self, channel_topics: set[ChannelTopicInfo]
self, channel_topics: set[ChannelTopicInfo], acting_user: UserProfile | None
) -> dict[ChannelTopicInfo, int | None]:
return self.mention_backend.get_topic_info_map(
channel_topics, acting_user=self.message_sender
)
return self.mention_backend.get_topic_info_map(channel_topics, acting_user=acting_user)
def silent_mention_syntax_for_user(user_profile: UserProfile) -> str: