emoji_picker: Fix the two different titles appearing for each emoji.

Fixes: #6286.
This commit is contained in:
Harshit Bansal 2017-08-26 23:10:30 +05:30 committed by Tim Abbott
parent 923fb7be16
commit 90d8b0f520
2 changed files with 6 additions and 5 deletions

View File

@ -326,7 +326,7 @@ function maybe_select_emoji(e) {
} else { } else {
reactions.toggle_emoji_reaction( reactions.toggle_emoji_reaction(
current_msg_list.selected_id(), current_msg_list.selected_id(),
first_emoji.attr('title') first_emoji.data("emoji-name")
); );
} }
} }
@ -350,7 +350,7 @@ exports.toggle_selected_emoji = function () {
return; return;
} }
var emoji_name = selected_emoji.title; var emoji_name = $(selected_emoji).data("emoji-name");
reactions.toggle_emoji_reaction(message_id, emoji_name); reactions.toggle_emoji_reaction(message_id, emoji_name);
}; };
@ -539,7 +539,7 @@ exports.register_click_handlers = function () {
// if the user has reacted to this message with this emoji // if the user has reacted to this message with this emoji
// the reaction is removed // the reaction is removed
// otherwise, the reaction is added // otherwise, the reaction is added
var emoji_name = this.title; var emoji_name = $(this).data("emoji-name");
var message_id = $(this).parent().parent().attr('data-message-id'); var message_id = $(this).parent().parent().attr('data-message-id');
var message = message_store.get(message_id); var message = message_store.get(message_id);
@ -555,7 +555,8 @@ exports.register_click_handlers = function () {
}); });
$(document).on('click', '.emoji-popover-emoji.composition', function (e) { $(document).on('click', '.emoji-popover-emoji.composition', function (e) {
var emoji_text = ':' + this.title + ':'; var emoji_name = $(this).data("emoji-name");
var emoji_text = ':' + emoji_name + ':';
var textarea = $("#new_message_content"); var textarea = $("#new_message_content");
textarea.caret(emoji_text); textarea.caret(emoji_text);
textarea.focus(); textarea.focus();

View File

@ -1,5 +1,5 @@
{{#with emoji_dict}} {{#with emoji_dict}}
<div class="emoji-popover-emoji {{# if ../message_id }}{{#if has_reacted}} reacted {{/if}} reaction {{else}} composition {{/if}}" title={{name}} tabindex="0" data-emoji-id="{{../type}}_{{../section}}_{{../index}}"> <div class="emoji-popover-emoji {{# if ../message_id }}{{#if has_reacted}} reacted {{/if}} reaction {{else}} composition {{/if}}" data-emoji-name={{name}} tabindex="0" data-emoji-id="{{../type}}_{{../section}}_{{../index}}">
{{#if is_realm_emoji}} {{#if is_realm_emoji}}
<img src="{{url}}" class="emoji" title= ":{{name}}:" /> <img src="{{url}}" class="emoji" title= ":{{name}}:" />
{{else}} {{else}}