From 5bdc00c3bee4e0a49d1baa4347d8057860212ee4 Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 6 Sep 2018 10:34:58 +1000 Subject: [PATCH] FIX: do not automatically route all actions to hovered posts This feature (hitting d when a post is hovered with mouse deletes) causes a lot of confusion and is very risky. --- .../javascripts/discourse/lib/keyboard-shortcuts.js.es6 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 index 37d6db132f0..01b9e3372e3 100644 --- a/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 +++ b/app/assets/javascripts/discourse/lib/keyboard-shortcuts.js.es6 @@ -36,6 +36,9 @@ const bindings = { "command+up": { handler: "goToFirstPost", anonymous: true }, j: { handler: "selectDown", anonymous: true }, k: { handler: "selectUp", anonymous: true }, + // we use this odd routing here vs a postAction: cause like + // has an animation so the widget handles that + // TODO: teach controller how to trigger the widget animation l: { click: ".topic-post.selected button.toggle-like" }, "m m": { handler: "setTrackingToMuted" }, // mark topic as muted "m r": { handler: "setTrackingToRegular" }, // mark topic as regular @@ -301,10 +304,6 @@ export default { $(".topic-post.selected article.boxed").data("post-id"), 10 ); - if (!selectedPostId) { - // If no post was selected, automatically select the hovered post. - selectedPostId = parseInt($("article.boxed:hover").data("post-id"), 10); - } if (selectedPostId) { const topicController = container.lookup("controller:topic"); const post = topicController