Add hotkey Q for quoting the currently focused post (#35941)

This commit is contained in:
diondiondion 2025-08-28 14:33:23 +02:00 committed by GitHub
commit 229cbc6a24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 36 additions and 1 deletions

View file

@ -105,6 +105,7 @@ const hotkeyMatcherMap = {
reply: just('r'),
favourite: just('f'),
boost: just('b'),
quote: just('q'),
mention: just('m'),
open: any('enter', 'o'),
openProfile: just('p'),

View file

@ -96,6 +96,7 @@ class Status extends ImmutablePureComponent {
onReply: PropTypes.func,
onFavourite: PropTypes.func,
onReblog: PropTypes.func,
onQuote: PropTypes.func,
onDelete: PropTypes.func,
onDirect: PropTypes.func,
onMention: PropTypes.func,
@ -276,6 +277,10 @@ class Status extends ImmutablePureComponent {
this.props.onReblog(this._properStatus(), e);
};
handleHotkeyQuote = () => {
this.props.onQuote(this._properStatus());
};
handleHotkeyMention = e => {
e.preventDefault();
this.props.onMention(this._properStatus().get('account'));
@ -386,6 +391,7 @@ class Status extends ImmutablePureComponent {
reply: this.handleHotkeyReply,
favourite: this.handleHotkeyFavourite,
boost: this.handleHotkeyBoost,
quote: this.handleHotkeyQuote,
mention: this.handleHotkeyMention,
open: this.handleHotkeyOpen,
openProfile: this.handleHotkeyOpenProfile,

View file

@ -59,6 +59,10 @@ const messages = defineMessages({
defaultMessage: 'Private posts cannot be quoted',
},
reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
reblog_or_quote: {
id: 'status.reblog_or_quote',
defaultMessage: 'Boost or quote',
},
reblog_cancel: {
id: 'status.cancel_reblog_private',
defaultMessage: 'Unboost',
@ -176,7 +180,7 @@ export const StatusReblogButton: FC<ReblogButtonProps> = ({
>
<IconButton
title={intl.formatMessage(
!disabled ? messages.reblog : messages.all_disabled,
!disabled ? messages.reblog_or_quote : messages.all_disabled,
)}
icon='retweet'
iconComponent={iconComponent}