mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
reaction.js: Update toggle_reaction().
Created get_selected_emoji() function. toggle_reaction() now doesn't require emoji_name and automatically looks for a selected_emoji if possible.
This commit is contained in:
@@ -282,6 +282,11 @@ exports.process_enter_key = function (e) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (popovers.reactions_popped()) {
|
||||||
|
reactions.toggle_reaction(current_msg_list.selected_id());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (exports.is_editing_stream_name(e)) {
|
if (exports.is_editing_stream_name(e)) {
|
||||||
$(e.target).parent().find(".checkmark").click();
|
$(e.target).parent().find(".checkmark").click();
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -51,7 +51,18 @@ exports.message_reaction_on_click = function (message_id, emoji_name) {
|
|||||||
send_reaction_ajax(message_id, emoji_name, operation);
|
send_reaction_ajax(message_id, emoji_name, operation);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function get_selected_emoji() {
|
||||||
|
return $(".reaction-popover-reaction").filter(":focus")[0];
|
||||||
|
}
|
||||||
|
|
||||||
exports.toggle_reaction = function (message_id, emoji_name) {
|
exports.toggle_reaction = function (message_id, emoji_name) {
|
||||||
|
var selected_emoji = get_selected_emoji();
|
||||||
|
if (emoji_name === undefined && selected_emoji === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (selected_emoji) {
|
||||||
|
emoji_name = selected_emoji.title;
|
||||||
|
}
|
||||||
var user_list = get_user_list_for_message_reaction(message_id, emoji_name);
|
var user_list = get_user_list_for_message_reaction(message_id, emoji_name);
|
||||||
var operation = 'add';
|
var operation = 'add';
|
||||||
if (user_list.indexOf(page_params.user_id) !== -1) {
|
if (user_list.indexOf(page_params.user_id) !== -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user