]> cat aescling's git repositories - mastodon.git/commitdiff
Adds keyboard hotkey for revealing/hiding statuses (#7173)
authorNeil Moore <dar13.dev@gmail.com>
Wed, 18 Apr 2018 01:33:59 +0000 (21:33 -0400)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 18 Apr 2018 01:33:59 +0000 (03:33 +0200)
Resolves #5550

app/javascript/mastodon/components/status.js
app/javascript/mastodon/features/status/index.js
app/javascript/mastodon/features/ui/index.js

index 6129b3f1ecb718666af4f8652a5fa94978d1e423..e5f7c9399bbbb7dc03b9292354a8e538ed98ead0 100644 (file)
@@ -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 (
index 55eff082399108e9a985e471b8b0fffbaec4de45..d5af2a459c5a11aa131633b886896993b5be5caf 100644 (file)
@@ -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 (
index 8b905fa1d5abd801add3d3231ea41991994ab59e..d2ef19e47f6db4ffb758335b0d7006927988d55c 100644 (file)
@@ -85,6 +85,7 @@ const keyMap = {
   goToProfile: 'g u',
   goToBlocked: 'g b',
   goToMuted: 'g m',
+  toggleHidden: 'x',
 };
 
 class SwitchingColumnsArea extends React.PureComponent {