Add support for emoji picker hotkeys in compose context.

This is a follow-up to merging the compose and reactions emoji
pickers.  The logic for what happens when the user picks an emoji via
the hotkeys (i.e. hits `enter`) was still attempting to add a reaction
to the currently selected message unconditionally.

This commit adds a check in the two `enter` key code paths, and does
the correct thing in each case.

Fixes #4736.
This commit is contained in:
Tejas Kasetty
2017-05-10 23:16:20 +05:30
committed by Tim Abbott
parent 52059d21a4
commit 5dd5c84854
3 changed files with 14 additions and 2 deletions

View File

@@ -116,7 +116,11 @@ function maybe_select_emoji(e) {
e.preventDefault();
var first_emoji = get_emoji_at_index(0);
if (first_emoji) {
exports.toggle_reaction(current_msg_list.selected_id(), first_emoji.title);
if (emoji_picker.is_composition(first_emoji)) {
first_emoji.click();
} else {
exports.toggle_reaction(current_msg_list.selected_id(), first_emoji.title);
}
}
}
}