mirror of
https://github.com/zulip/zulip.git
synced 2026-07-06 21:18:58 +08:00
keyboard_ui: Add a new keyboard shortcut '='.
Added new keyboard shortcut '=' to toggle the first emoji on the selected message if it exists, else do nothing. Fixes: #24256.
This commit is contained in:
parent
a80f96dde6
commit
079eb6a4da
@ -123,6 +123,7 @@ const keydown_either_mappings = {
|
||||
const keypress_mappings = {
|
||||
42: {name: "star_deprecated", message_view_only: true}, // '*'
|
||||
43: {name: "thumbs_up_emoji", message_view_only: true}, // '+'
|
||||
61: {name: "upvote_first_emoji", message_view_only: true}, // '='
|
||||
45: {name: "toggle_message_collapse", message_view_only: true}, // '-'
|
||||
47: {name: "search", message_view_only: false}, // '/'
|
||||
58: {name: "toggle_reactions_popover", message_view_only: true}, // ':'
|
||||
@ -967,6 +968,23 @@ export function process_hotkey(e, hotkey) {
|
||||
reactions.toggle_emoji_reaction(msg.id, canonical_name);
|
||||
return true;
|
||||
}
|
||||
case "upvote_first_emoji": {
|
||||
// '=': If the current message has at least one emoji
|
||||
// reaction, toggle out vote on the first one.
|
||||
const message_reactions = reactions.get_message_reactions(msg);
|
||||
if (message_reactions.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const first_reaction = message_reactions[0];
|
||||
if (!first_reaction) {
|
||||
// If the message has no emoji reactions, do nothing.
|
||||
return true;
|
||||
}
|
||||
|
||||
reactions.toggle_emoji_reaction(msg.id, first_reaction.emoji_name);
|
||||
return true;
|
||||
}
|
||||
case "toggle_topic_mute":
|
||||
muted_topics_ui.toggle_topic_mute(msg);
|
||||
return true;
|
||||
|
||||
@ -358,6 +358,9 @@ run_test("misc", ({override}) => {
|
||||
|
||||
assert_mapping("@", compose_actions, "reply_with_mention");
|
||||
assert_mapping("+", reactions, "toggle_emoji_reaction");
|
||||
// Without an existing emoji reaction, this next one will only
|
||||
// call get_message_reactions, so we verify just that.
|
||||
assert_mapping("=", reactions, "get_message_reactions");
|
||||
assert_mapping("-", condense, "toggle_collapse");
|
||||
assert_mapping("r", compose_actions, "respond_to_message");
|
||||
assert_mapping("R", compose_actions, "respond_to_message", true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user