markdown: Render silent mentions as **name**.

This change should help people discover to distinguish
silent mentions in text as a part of Zulip syntax while
differentiating them from regular mentions.
This commit is contained in:
Rohitt Vashishtha
2019-02-15 19:58:54 +00:00
committed by Tim Abbott
parent 57b9991396
commit 44ec83ef28
7 changed files with 21 additions and 14 deletions

View File

@@ -82,9 +82,9 @@ exports.apply_markdown = function (message) {
if (silently) {
str += '<span class="user-mention silent" data-user-id="' + person.user_id + '">';
} else {
str += '<span class="user-mention" data-user-id="' + person.user_id + '">';
str += '<span class="user-mention" data-user-id="' + person.user_id + '">@';
}
return str + '@' + escape(person.full_name, true) + '</span>';
return str + escape(person.full_name, true) + '</span>';
} else if (name === 'all' || name === 'everyone' || name === 'stream') {
message.mentioned = true;
return '<span class="user-mention" data-user-id="*">' +
@@ -107,9 +107,11 @@ exports.apply_markdown = function (message) {
},
silencedMentionHandler: function (quote) {
// Silence quoted mentions.
var user_mention_re = /<span.*user-mention.*data-user-id="(\d+|\*)"[^>]*>/gm;
var user_mention_re = /<span.*user-mention.*data-user-id="(\d+|\*)"[^>]*>@/gm;
quote = quote.replace(user_mention_re, function (match) {
return match.replace(/"user-mention"/g, '"user-mention silent"');
match = match.replace(/"user-mention"/g, '"user-mention silent"');
match = match.replace(/>@/g, '>');
return match;
});
// In most cases, if you are being mentioned in the message you're quoting, you wouldn't
// mention yourself outside of the blockquote (and, above it). If that you do that, the