mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +00:00
compose_actions: Use people.get_mention_syntax in reply_with_mention.
This commit is contained in:
committed by
Tim Abbott
parent
b18f9def06
commit
38cddf7d54
@@ -207,6 +207,7 @@ run_test('reply_with_mention', () => {
|
||||
subject: 'python',
|
||||
reply_to: 'bob', // compose.start needs this for dubious reasons
|
||||
sender_full_name: 'Bob Roberts',
|
||||
sender_id: 40,
|
||||
};
|
||||
stub_selected_message(msg);
|
||||
|
||||
@@ -222,6 +223,25 @@ run_test('reply_with_mention', () => {
|
||||
assert.equal($('#stream').val(), 'devel');
|
||||
assert.equal(syntax_to_insert, '@**Bob Roberts**');
|
||||
assert(compose_state.has_message_content());
|
||||
|
||||
// Test for extended mention syntax
|
||||
var bob_1 = {
|
||||
user_id: 30,
|
||||
email: 'bob1@example.com',
|
||||
full_name: 'Bob Roberts',
|
||||
};
|
||||
people.add_in_realm(bob_1);
|
||||
var bob_2 = {
|
||||
user_id: 40,
|
||||
email: 'bob2@example.com',
|
||||
full_name: 'Bob Roberts',
|
||||
};
|
||||
people.add_in_realm(bob_2);
|
||||
|
||||
reply_with_mention(opts);
|
||||
assert.equal($('#stream').val(), 'devel');
|
||||
assert.equal(syntax_to_insert, '@**Bob Roberts|40**');
|
||||
assert(compose_state.has_message_content());
|
||||
});
|
||||
|
||||
run_test('get_focus_area', () => {
|
||||
|
||||
@@ -336,7 +336,7 @@ exports.respond_to_message = function (opts) {
|
||||
exports.reply_with_mention = function (opts) {
|
||||
exports.respond_to_message(opts);
|
||||
var message = current_msg_list.selected_message();
|
||||
var mention = '@**' + message.sender_full_name + '**';
|
||||
var mention = people.get_mention_syntax(message.sender_full_name, message.sender_id);
|
||||
compose_ui.insert_syntax_and_focus(mention);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user