From fad7b9f5f297f970056d86cef0139e709ed47516 Mon Sep 17 00:00:00 2001
From: Neil Moore <dar13.dev@gmail.com>
Date: Tue, 17 Apr 2018 21:33:59 -0400
Subject: [PATCH] Adds keyboard hotkey for revealing/hiding statuses (#7173)

Resolves #5550
---
 app/javascript/mastodon/components/status.js     | 5 +++++
 app/javascript/mastodon/features/status/index.js | 5 +++++
 app/javascript/mastodon/features/ui/index.js     | 1 +
 3 files changed, 11 insertions(+)

diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js
index 6129b3f1ec..e5f7c9399b 100644
--- a/app/javascript/mastodon/components/status.js
+++ b/app/javascript/mastodon/components/status.js
@@ -122,6 +122,10 @@ export default class Status extends ImmutablePureComponent {
     this.props.onMoveDown(this.props.status.get('id'));
   }
 
+  handleHotkeyToggleHidden = () => {
+    this.props.onToggleHidden(this._properStatus());
+  }
+
   _properStatus () {
     const { status } = this.props;
 
@@ -224,6 +228,7 @@ export default class Status extends ImmutablePureComponent {
       openProfile: this.handleHotkeyOpenProfile,
       moveUp: this.handleHotkeyMoveUp,
       moveDown: this.handleHotkeyMoveDown,
+      toggleHidden: this.handleHotkeyToggleHidden,
     };
 
     return (
diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js
index 55eff08239..d5af2a459c 100644
--- a/app/javascript/mastodon/features/status/index.js
+++ b/app/javascript/mastodon/features/status/index.js
@@ -244,6 +244,10 @@ export default class Status extends ImmutablePureComponent {
     this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
   }
 
+  handleHotkeyToggleHidden = () => {
+    this.handleToggleHidden(this.props.status);
+  }
+
   handleMoveUp = id => {
     const { status, ancestorsIds, descendantsIds } = this.props;
 
@@ -354,6 +358,7 @@ export default class Status extends ImmutablePureComponent {
       boost: this.handleHotkeyBoost,
       mention: this.handleHotkeyMention,
       openProfile: this.handleHotkeyOpenProfile,
+      toggleHidden: this.handleHotkeyToggleHidden,
     };
 
     return (
diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js
index 8b905fa1d5..d2ef19e47f 100644
--- a/app/javascript/mastodon/features/ui/index.js
+++ b/app/javascript/mastodon/features/ui/index.js
@@ -85,6 +85,7 @@ const keyMap = {
   goToProfile: 'g u',
   goToBlocked: 'g b',
   goToMuted: 'g m',
+  toggleHidden: 'x',
 };
 
 class SwitchingColumnsArea extends React.PureComponent {
-- 
GitLab