Add new "quick boosting" setting (#36516)

This commit is contained in:
diondiondion authored and GitHub committed 2025-10-17 13:02:47 +00:00
1 parent c96e28a41d
commit 6dad80eb8c
10 files changed
+120 -6

No files matched your search

@@ -18,8 +18,9 @@ import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/
import { IconButton } from '../../../components/icon_button';
import { Dropdown } from 'mastodon/components/dropdown_menu';
import { me } from '../../../initial_state';
import { me, quickBoosting } from '../../../initial_state';
import { BoostButton } from '@/mastodon/components/status/boost_button';
import { quoteItemState, selectStatusState } from '@/mastodon/components/status/boost_button_utils';
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
@@ -60,6 +61,7 @@ const mapStateToProps = (state, { status }) => {
return ({
relationship: state.getIn(['relationships', status.getIn(['account', 'id'])]),
quotedAccountId: quotedStatusId ? state.getIn(['statuses', quotedStatusId, 'account']) : null,
statusQuoteState: selectStatusState(state, status),
});
};
@@ -68,6 +70,7 @@ class ActionBar extends PureComponent {
identity: identityContextPropShape,
status: ImmutablePropTypes.map.isRequired,
relationship: ImmutablePropTypes.record,
statusQuoteState: PropTypes.object,
quotedAccountId: ImmutablePropTypes.string,
onReply: PropTypes.func.isRequired,
onReblog: PropTypes.func.isRequired,
@@ -116,6 +119,10 @@ class ActionBar extends PureComponent {
this.props.onRevokeQuote(this.props.status);
};
handleQuoteClick = () => {
this.props.onQuote(this.props.status);
};
handleQuotePolicyChange = () => {
this.props.onQuotePolicyChange(this.props.status);
};
@@ -200,7 +207,7 @@ class ActionBar extends PureComponent {
};
render () {
const { status, relationship, quotedAccountId, intl } = this.props;
const { status, relationship, statusQuoteState, quotedAccountId, intl } = this.props;
const { signedIn, permissions } = this.props.identity;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
@@ -222,6 +229,20 @@ class ActionBar extends PureComponent {
menu.push({ text: intl.formatMessage(messages.share), action: this.handleShare });
}
if (quickBoosting && signedIn) {
const quoteItem = quoteItemState(statusQuoteState);
menu.push(null);
menu.push({
text: intl.formatMessage(quoteItem.title),
description: quoteItem.meta
? intl.formatMessage(quoteItem.meta)
: undefined,
disabled: quoteItem.disabled,
action: this.handleQuoteClick,
});
menu.push(null);
}
if (publicStatus && (signedIn || !isRemote)) {
menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
}