markdown: Move code related to @mentions to markdown.js.

For consistency, we should keep all the code that works with
@mentions in markdown.js. In this case, message_list_view was
rewriting the contents of the mentions in cases where users'
names had been changed since we rendered their mention.
This commit is contained in:
Rohitt Vashishtha
2019-02-15 22:24:26 +00:00
committed by Tim Abbott
parent 44ec83ef28
commit 92658d2ac9
3 changed files with 19 additions and 5 deletions

View File

@@ -36,6 +36,15 @@ var backend_only_markdown_re = [
/[^\s]*(?:twitter|youtube).com\/[^\s]*/,
];
// Helper function to update a mentioned user's name.
exports.set_name_in_mention_element = function (element, name) {
if ($(element).hasClass('silent')) {
$(element).text(name);
} else {
$(element).text("@" + name);
}
};
exports.contains_backend_only_syntax = function (content) {
// Try to guess whether or not a message has bugdown in it
// If it doesn't, we can immediately render it client-side