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

Resolves #5550
This commit is contained in:
Neil Moore 2018-04-17 21:33:59 -04:00 committed by Eugen Rochko
parent 8cd19d3eec
commit e0853e52d8
3 changed files with 11 additions and 0 deletions

View 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 (

View 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 (

View file

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