Use different confirmation modal/snackbar text for post editing
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
7b355dea6e
commit
81af0e64f1
4 changed files with 17 additions and 7 deletions
|
@ -92,6 +92,7 @@ const messages = defineMessages({
|
|||
exceededVideoDurationLimit: { id: 'upload_error.video_duration_limit', defaultMessage: 'Video exceeds the current duration limit ({limit} seconds)' },
|
||||
scheduleError: { id: 'compose.invalid_schedule', defaultMessage: 'You must schedule a post at least 5 minutes out.' },
|
||||
success: { id: 'compose.submit_success', defaultMessage: 'Your post was sent' },
|
||||
editSuccess: { id: 'compose.edit_success', defaultMessage: 'Your post was edited' },
|
||||
uploadErrorLimit: { id: 'upload_error.limit', defaultMessage: 'File upload limit exceeded.' },
|
||||
uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' },
|
||||
view: { id: 'snackbar.view', defaultMessage: 'View' },
|
||||
|
@ -203,12 +204,12 @@ const directComposeById = (accountId: string) =>
|
|||
dispatch(openModal('COMPOSE'));
|
||||
};
|
||||
|
||||
const handleComposeSubmit = (dispatch: AppDispatch, getState: () => RootState, data: APIEntity, status: string) => {
|
||||
const handleComposeSubmit = (dispatch: AppDispatch, getState: () => RootState, data: APIEntity, status: string, edit?: boolean) => {
|
||||
if (!dispatch || !getState) return;
|
||||
|
||||
dispatch(insertIntoTagHistory(data.tags || [], status));
|
||||
dispatch(submitComposeSuccess({ ...data }));
|
||||
dispatch(snackbar.success(messages.success, messages.view, `/@${data.account.acct}/posts/${data.id}`));
|
||||
dispatch(snackbar.success(edit ? messages.editSuccess : messages.success, messages.view, `/@${data.account.acct}/posts/${data.id}`));
|
||||
};
|
||||
|
||||
const needsDescriptions = (state: RootState) => {
|
||||
|
@ -287,7 +288,7 @@ const submitCompose = (routerHistory?: History, force = false) =>
|
|||
if (!statusId && data.visibility === 'direct' && getState().conversations.mounted <= 0 && routerHistory) {
|
||||
routerHistory.push('/messages');
|
||||
}
|
||||
handleComposeSubmit(dispatch, getState, data, status);
|
||||
handleComposeSubmit(dispatch, getState, data, status, !!statusId);
|
||||
}).catch(function(error) {
|
||||
dispatch(submitComposeFail(error));
|
||||
});
|
||||
|
|
|
@ -11,6 +11,7 @@ import ComposeFormContainer from '../../compose/containers/compose_form_containe
|
|||
const messages = defineMessages({
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||
confirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
|
||||
discardConfirm: { id: 'confirmations.discard_edit.confirm', defaultMessage: 'Discard' },
|
||||
});
|
||||
|
||||
interface IComposeModal {
|
||||
|
@ -31,9 +32,13 @@ const ComposeModal: React.FC<IComposeModal> = ({ onClose }) => {
|
|||
if (composeText) {
|
||||
dispatch(openModal('CONFIRM', {
|
||||
icon: require('@tabler/icons/trash.svg'),
|
||||
heading: <FormattedMessage id='confirmations.delete.heading' defaultMessage='Delete post' />,
|
||||
message: <FormattedMessage id='confirmations.delete.message' defaultMessage='Are you sure you want to delete this post?' />,
|
||||
confirm: intl.formatMessage(messages.confirm),
|
||||
heading: statusId
|
||||
? <FormattedMessage id='confirmations.discard_edit.heading' defaultMessage='Discard post changes' />
|
||||
: <FormattedMessage id='confirmations.delete.heading' defaultMessage='Delete post' />,
|
||||
message: statusId
|
||||
? <FormattedMessage id='confirmations.discard_edit.message' defaultMessage='Are you sure you want to discard changes to this post?' />
|
||||
: <FormattedMessage id='confirmations.delete.message' defaultMessage='Are you sure you want to delete this post?' />,
|
||||
confirm: intl.formatMessage(statusId ? messages.discardConfirm : messages.confirm),
|
||||
onConfirm: () => {
|
||||
dispatch(closeModal('COMPOSE'));
|
||||
dispatch(cancelReplyCompose());
|
||||
|
|
|
@ -276,6 +276,7 @@
|
|||
"compare_history_modal.header": "Historia edycji",
|
||||
"compose.character_counter.title": "Wykorzystano {chars} z {maxChars} znaków",
|
||||
"compose.invalid_schedule": "Musisz zaplanować wpis przynajmniej 5 minut wcześniej.",
|
||||
"compose.edit_success": "Twój wpis został zedytowany",
|
||||
"compose.submit_success": "Twój wpis został wysłany",
|
||||
"compose_form.direct_message_warning": "Ten wpis będzie widoczny tylko dla wszystkich wspomnianych użytkowników.",
|
||||
"compose_form.hashtag_warning": "Ten wpis nie będzie widoczny pod podanymi hashtagami, ponieważ jest oznaczony jako niewidoczny. Tylko publiczne wpisy mogą zostać znalezione z użyciem hashtagów.",
|
||||
|
@ -338,6 +339,9 @@
|
|||
"confirmations.delete_list.confirm": "Usuń",
|
||||
"confirmations.delete_list.heading": "Usuń listę",
|
||||
"confirmations.delete_list.message": "Czy na pewno chcesz bezpowrotnie usunąć tą listę?",
|
||||
"confirmations.discard_edit.confirm": "Odrzuć",
|
||||
"confirmations.discard_edit.heading": "Odrzuć edycję wpisu",
|
||||
"confirmations.discard_edit.message": "Czy na pewno chcesz odrzucić zmiany w tym wpisie?",
|
||||
"confirmations.domain_block.confirm": "Ukryj wszysyko z domeny",
|
||||
"confirmations.domain_block.heading": "Zablokuj {domain}",
|
||||
"confirmations.domain_block.message": "Czy na pewno chcesz zablokować całą domenę {domain}? Zwykle lepszym rozwiązaniem jest blokada lub wyciszenie kilku użytkowników.",
|
||||
|
|
|
@ -444,7 +444,7 @@ export default function compose(state = ReducerRecord({ idempotencyKey: uuid(),
|
|||
map.set('content_type', action.contentType || 'text/plain');
|
||||
map.set('quote', action.status.get('quote'));
|
||||
|
||||
if (action.v?.software === PLEROMA && !action.withRedraft && hasIntegerMediaIds(action.status)) {
|
||||
if (action.v?.software === PLEROMA && action.withRedraft && hasIntegerMediaIds(action.status)) {
|
||||
map.set('media_attachments', ImmutableList());
|
||||
} else {
|
||||
map.set('media_attachments', action.status.media_attachments);
|
||||
|
|
Loading…
Reference in a new issue