From 76e84288d9416aece31e8f3ddfbd8b59ca2173e7 Mon Sep 17 00:00:00 2001 From: Joshua Pan Date: Thu, 23 Mar 2017 03:25:01 +0000 Subject: [PATCH] Add M hotkey to toggle mute/unmute topics. Get rid of current_msg_list.selected_message() redundancy. --- static/js/hotkey.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/static/js/hotkey.js b/static/js/hotkey.js index 48dbc252ac..fbf8dfe051 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -103,6 +103,7 @@ var keypress_mappings = { 71: {name: 'G_end', message_view_only: true}, // 'G' 74: {name: 'vim_page_down', message_view_only: true}, // 'J' 75: {name: 'vim_page_up', message_view_only: true}, // 'K' + 77: {name: 'toggle_mute', message_view_only: true}, // 'M' 80: {name: 'narrow_private', message_view_only: true}, // 'P' 82: {name: 'respond_to_author', message_view_only: true}, // 'R' 83: {name: 'narrow_by_subject', message_view_only: true}, //'S' @@ -610,12 +611,13 @@ exports.process_hotkey = function (e, hotkey) { return true; } + var msg = current_msg_list.selected_message(); // Shortcuts that operate on a message switch (event_name) { case 'message_actions': return popovers.open_message_menu(); case 'star_message': - return message_flags.toggle_starred(current_msg_list.selected_message()); + return message_flags.toggle_starred(msg); case 'narrow_by_recipient': return do_narrow_action(narrow.by_recipient); case 'narrow_by_subject': @@ -638,7 +640,10 @@ exports.process_hotkey = function (e, hotkey) { open_reactions(); return true; case 'thumbs_up_emoji': // '+': reacts with thumbs up emoji on selected message - reactions.toggle_reaction(current_msg_list.selected_id(), '+1'); + reactions.toggle_reaction(msg.id, '+1'); + return true; + case 'toggle_mute': + muting_ui.toggle_mute(msg); return true; }