New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
markdown: Remove unnecessary checks for zulip_message. #19553
Conversation
This commits removes some unnecessary checks for `self.md.zulip_message`, which were put there historically, as earlier we used to add the additional properties like mentions_user_ids, alert_words, etc. to Message dict only. These were later moved to MessageRenderingResult class in commit 75cea32 but the checks weren't removed. This is important because while rendering the messages imported from other chat tools (like Rocket.Chat), the Message dict is not passed to the markdown, due to which the checks for `self.md.zerver_message` fails and hence, things like user mentions, stream/topic mentions are not rendered in the imported messages properly.
Other than the messages, I think these changes will also affect the markdown in realm//stream descriptions. But I think we should support realm emojis, stream-topic mentions and maybe even user mentions in realm/stream descriptions also. Other than realm/stream descriptions, I couldn't find any other place where we use this markdown processor. Is there any? |
I have looked at the PR. I wasn't aware of the possibility of extending the markdown processor during the refactor. However, I'm not sure if directly rendering stream/user mentions or realm-specific emoji from a third-part platform would work just fine. We support this feature with this converter in For supporting stream/user mentions and etc. in descriptions, I think we will need to add some tests to validate this. Probably in |
Regarding the CZO issue, I guess the right direction for us here might be completely remove it from the markdown processor. |
We actually convert the markdown while importing messages from other chat platforms to Zulip, so that it's compatible with Zulip markdown (like converting But after your refactor in 75cea32, I think we don't actually need to check if So, I was just wondering if there would be any other consequences of removing checks for |
I don't think there is any other than |
This commits removes some unnecessary checks for
self.md.zulip_message
,which were put there historically, as earlier we used to add the additional
properties like mentions_user_ids, alert_words, etc. to Message dict
only. These were later moved to MessageRenderingResult class in commit
75cea32 but the checks weren't removed.
This is important because while rendering the messages imported from
other chat tools (like Rocket.Chat), the Message dict is not passed to
the markdown, due to which the checks for
self.md.zerver_message
failsand hence, things like user mentions, stream/topic mentions are not
rendered in the imported messages properly.