Add UI for revoking quote posts (#35689)
This commit is contained in:
parent
c8f263c419
commit
55a98580aa
10 changed files with 131 additions and 9 deletions
|
|
@ -10,3 +10,4 @@ export { ConfirmClearNotificationsModal } from './clear_notifications';
|
|||
export { ConfirmLogOutModal } from './log_out';
|
||||
export { ConfirmFollowToListModal } from './follow_to_list';
|
||||
export { ConfirmMissingAltTextModal } from './missing_alt_text';
|
||||
export { ConfirmRevokeQuoteModal } from './revoke_quote';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
import { useCallback } from 'react';
|
||||
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
|
||||
import { revokeQuote } from 'mastodon/actions/interactions_typed';
|
||||
import { useAppDispatch } from 'mastodon/store';
|
||||
|
||||
import type { BaseConfirmationModalProps } from './confirmation_modal';
|
||||
import { ConfirmationModal } from './confirmation_modal';
|
||||
|
||||
const messages = defineMessages({
|
||||
revokeQuoteTitle: {
|
||||
id: 'confirmations.revoke_quote.title',
|
||||
defaultMessage: 'Remove post?',
|
||||
},
|
||||
revokeQuoteMessage: {
|
||||
id: 'confirmations.revoke_quote.message',
|
||||
defaultMessage: 'This action cannot be undone.',
|
||||
},
|
||||
revokeQuoteConfirm: {
|
||||
id: 'confirmations.revoke_quote.confirm',
|
||||
defaultMessage: 'Remove post',
|
||||
},
|
||||
});
|
||||
|
||||
export const ConfirmRevokeQuoteModal: React.FC<
|
||||
{
|
||||
statusId: string;
|
||||
quotedStatusId: string;
|
||||
} & BaseConfirmationModalProps
|
||||
> = ({ statusId, quotedStatusId, onClose }) => {
|
||||
const intl = useIntl();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const onConfirm = useCallback(() => {
|
||||
void dispatch(revokeQuote({ quotedStatusId, statusId }));
|
||||
}, [dispatch, statusId, quotedStatusId]);
|
||||
|
||||
return (
|
||||
<ConfirmationModal
|
||||
title={intl.formatMessage(messages.revokeQuoteTitle)}
|
||||
message={intl.formatMessage(messages.revokeQuoteMessage)}
|
||||
confirm={intl.formatMessage(messages.revokeQuoteConfirm)}
|
||||
onConfirm={onConfirm}
|
||||
onClose={onClose}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
@ -37,6 +37,7 @@ import {
|
|||
ConfirmLogOutModal,
|
||||
ConfirmFollowToListModal,
|
||||
ConfirmMissingAltTextModal,
|
||||
ConfirmRevokeQuoteModal,
|
||||
} from './confirmation_modals';
|
||||
import { ImageModal } from './image_modal';
|
||||
import MediaModal from './media_modal';
|
||||
|
|
@ -59,6 +60,7 @@ export const MODAL_COMPONENTS = {
|
|||
'CONFIRM_LOG_OUT': () => Promise.resolve({ default: ConfirmLogOutModal }),
|
||||
'CONFIRM_FOLLOW_TO_LIST': () => Promise.resolve({ default: ConfirmFollowToListModal }),
|
||||
'CONFIRM_MISSING_ALT_TEXT': () => Promise.resolve({ default: ConfirmMissingAltTextModal }),
|
||||
'CONFIRM_REVOKE_QUOTE': () => Promise.resolve({ default: ConfirmRevokeQuoteModal }),
|
||||
'MUTE': MuteModal,
|
||||
'BLOCK': BlockModal,
|
||||
'DOMAIN_BLOCK': DomainBlockModal,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue