Adds keyboard hotkey for revealing/hiding statuses (#7173)

Resolves #5550
master
Neil Moore 7 years ago committed by Eugen Rochko
parent e5dd385431
commit fad7b9f5f2
  1. 5
      app/javascript/mastodon/components/status.js
  2. 5
      app/javascript/mastodon/features/status/index.js
  3. 1
      app/javascript/mastodon/features/ui/index.js

@ -122,6 +122,10 @@ export default class Status extends ImmutablePureComponent {
this.props.onMoveDown(this.props.status.get('id')); this.props.onMoveDown(this.props.status.get('id'));
} }
handleHotkeyToggleHidden = () => {
this.props.onToggleHidden(this._properStatus());
}
_properStatus () { _properStatus () {
const { status } = this.props; const { status } = this.props;
@ -224,6 +228,7 @@ export default class Status extends ImmutablePureComponent {
openProfile: this.handleHotkeyOpenProfile, openProfile: this.handleHotkeyOpenProfile,
moveUp: this.handleHotkeyMoveUp, moveUp: this.handleHotkeyMoveUp,
moveDown: this.handleHotkeyMoveDown, moveDown: this.handleHotkeyMoveDown,
toggleHidden: this.handleHotkeyToggleHidden,
}; };
return ( return (

@ -244,6 +244,10 @@ export default class Status extends ImmutablePureComponent {
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`); this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
} }
handleHotkeyToggleHidden = () => {
this.handleToggleHidden(this.props.status);
}
handleMoveUp = id => { handleMoveUp = id => {
const { status, ancestorsIds, descendantsIds } = this.props; const { status, ancestorsIds, descendantsIds } = this.props;
@ -354,6 +358,7 @@ export default class Status extends ImmutablePureComponent {
boost: this.handleHotkeyBoost, boost: this.handleHotkeyBoost,
mention: this.handleHotkeyMention, mention: this.handleHotkeyMention,
openProfile: this.handleHotkeyOpenProfile, openProfile: this.handleHotkeyOpenProfile,
toggleHidden: this.handleHotkeyToggleHidden,
}; };
return ( return (

@ -85,6 +85,7 @@ const keyMap = {
goToProfile: 'g u', goToProfile: 'g u',
goToBlocked: 'g b', goToBlocked: 'g b',
goToMuted: 'g m', goToMuted: 'g m',
toggleHidden: 'x',
}; };
class SwitchingColumnsArea extends React.PureComponent { class SwitchingColumnsArea extends React.PureComponent {

Loading…
Cancel
Save