kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
fix reblogs with confirmation modal enabled
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>strip-front-mentions
rodzic
d91cbb3f56
commit
49d61f84e1
|
@ -66,174 +66,176 @@ const makeMapStateToProps = () => {
|
||||||
return mapStateToProps;
|
return mapStateToProps;
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { intl }) => ({
|
const mapDispatchToProps = (dispatch, { intl }) => {
|
||||||
|
function onModalReblog(status) {
|
||||||
onReply(status, router) {
|
|
||||||
dispatch((_, getState) => {
|
|
||||||
const state = getState();
|
|
||||||
if (state.getIn(['compose', 'text']).trim().length !== 0) {
|
|
||||||
dispatch(openModal('CONFIRM', {
|
|
||||||
message: intl.formatMessage(messages.replyMessage),
|
|
||||||
confirm: intl.formatMessage(messages.replyConfirm),
|
|
||||||
onConfirm: () => dispatch(replyCompose(status, router)),
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
dispatch(replyCompose(status, router));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onModalReblog(status) {
|
|
||||||
if (status.get('reblogged')) {
|
if (status.get('reblogged')) {
|
||||||
dispatch(unreblog(status));
|
dispatch(unreblog(status));
|
||||||
} else {
|
} else {
|
||||||
dispatch(reblog(status));
|
dispatch(reblog(status));
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
onReblog(status, e) {
|
return {
|
||||||
dispatch((_, getState) => {
|
onReply(status, router) {
|
||||||
const boostModal = getSettings(getState()).get('boostModal');
|
dispatch((_, getState) => {
|
||||||
if (e.shiftKey || !boostModal) {
|
const state = getState();
|
||||||
this.onModalReblog(status);
|
if (state.getIn(['compose', 'text']).trim().length !== 0) {
|
||||||
|
dispatch(openModal('CONFIRM', {
|
||||||
|
message: intl.formatMessage(messages.replyMessage),
|
||||||
|
confirm: intl.formatMessage(messages.replyConfirm),
|
||||||
|
onConfirm: () => dispatch(replyCompose(status, router)),
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
dispatch(replyCompose(status, router));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onModalReblog,
|
||||||
|
|
||||||
|
onReblog(status, e) {
|
||||||
|
dispatch((_, getState) => {
|
||||||
|
const boostModal = getSettings(getState()).get('boostModal');
|
||||||
|
if (e.shiftKey || !boostModal) {
|
||||||
|
this.onModalReblog(status);
|
||||||
|
} else {
|
||||||
|
dispatch(openModal('BOOST', { status, onReblog: onModalReblog }));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onFavourite(status) {
|
||||||
|
if (status.get('favourited')) {
|
||||||
|
dispatch(unfavourite(status));
|
||||||
} else {
|
} else {
|
||||||
dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
|
dispatch(favourite(status));
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
},
|
|
||||||
|
|
||||||
onFavourite(status) {
|
onBookmark(status) {
|
||||||
if (status.get('favourited')) {
|
if (status.get('bookmarked')) {
|
||||||
dispatch(unfavourite(status));
|
dispatch(unbookmark(intl, status));
|
||||||
} else {
|
|
||||||
dispatch(favourite(status));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onBookmark(status) {
|
|
||||||
if (status.get('bookmarked')) {
|
|
||||||
dispatch(unbookmark(intl, status));
|
|
||||||
} else {
|
|
||||||
dispatch(bookmark(intl, status));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onPin(status) {
|
|
||||||
if (status.get('pinned')) {
|
|
||||||
dispatch(unpin(status));
|
|
||||||
} else {
|
|
||||||
dispatch(pin(status));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onEmbed(status) {
|
|
||||||
dispatch(openModal('EMBED', {
|
|
||||||
url: status.get('url'),
|
|
||||||
onError: error => dispatch(showAlertForError(error)),
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
|
|
||||||
onDelete(status, history, withRedraft = false) {
|
|
||||||
dispatch((_, getState) => {
|
|
||||||
const deleteModal = getSettings(getState()).get('deleteModal');
|
|
||||||
if (!deleteModal) {
|
|
||||||
dispatch(deleteStatus(status.get('id'), history, withRedraft));
|
|
||||||
} else {
|
} else {
|
||||||
dispatch(openModal('CONFIRM', {
|
dispatch(bookmark(intl, status));
|
||||||
message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
|
|
||||||
confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
|
|
||||||
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
},
|
|
||||||
|
|
||||||
onDirect(account, router) {
|
onPin(status) {
|
||||||
dispatch(directCompose(account, router));
|
if (status.get('pinned')) {
|
||||||
},
|
dispatch(unpin(status));
|
||||||
|
} else {
|
||||||
|
dispatch(pin(status));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onChat(account, router) {
|
onEmbed(status) {
|
||||||
dispatch(launchChat(account.get('id'), router));
|
dispatch(openModal('EMBED', {
|
||||||
},
|
url: status.get('url'),
|
||||||
|
onError: error => dispatch(showAlertForError(error)),
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
onMention(account, router) {
|
onDelete(status, history, withRedraft = false) {
|
||||||
dispatch(mentionCompose(account, router));
|
dispatch((_, getState) => {
|
||||||
},
|
const deleteModal = getSettings(getState()).get('deleteModal');
|
||||||
|
if (!deleteModal) {
|
||||||
|
dispatch(deleteStatus(status.get('id'), history, withRedraft));
|
||||||
|
} else {
|
||||||
|
dispatch(openModal('CONFIRM', {
|
||||||
|
message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
|
||||||
|
confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
|
||||||
|
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onOpenMedia(media, index) {
|
onDirect(account, router) {
|
||||||
dispatch(openModal('MEDIA', { media, index }));
|
dispatch(directCompose(account, router));
|
||||||
},
|
},
|
||||||
|
|
||||||
onOpenVideo(media, time) {
|
onChat(account, router) {
|
||||||
dispatch(openModal('VIDEO', { media, time }));
|
dispatch(launchChat(account.get('id'), router));
|
||||||
},
|
},
|
||||||
|
|
||||||
onOpenAudio(media, time) {
|
onMention(account, router) {
|
||||||
dispatch(openModal('AUDIO', { media, time }));
|
dispatch(mentionCompose(account, router));
|
||||||
},
|
},
|
||||||
|
|
||||||
onBlock(status) {
|
onOpenMedia(media, index) {
|
||||||
const account = status.get('account');
|
dispatch(openModal('MEDIA', { media, index }));
|
||||||
dispatch(openModal('CONFIRM', {
|
},
|
||||||
message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
|
||||||
confirm: intl.formatMessage(messages.blockConfirm),
|
|
||||||
onConfirm: () => dispatch(blockAccount(account.get('id'))),
|
|
||||||
secondary: intl.formatMessage(messages.blockAndReport),
|
|
||||||
onSecondary: () => {
|
|
||||||
dispatch(blockAccount(account.get('id')));
|
|
||||||
dispatch(initReport(account, status));
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
|
|
||||||
onReport(status) {
|
onOpenVideo(media, time) {
|
||||||
dispatch(initReport(status.get('account'), status));
|
dispatch(openModal('VIDEO', { media, time }));
|
||||||
},
|
},
|
||||||
|
|
||||||
onMute(account) {
|
onOpenAudio(media, time) {
|
||||||
dispatch(initMuteModal(account));
|
dispatch(openModal('AUDIO', { media, time }));
|
||||||
},
|
},
|
||||||
|
|
||||||
onMuteConversation(status) {
|
onBlock(status) {
|
||||||
if (status.get('muted')) {
|
const account = status.get('account');
|
||||||
dispatch(unmuteStatus(status.get('id')));
|
dispatch(openModal('CONFIRM', {
|
||||||
} else {
|
message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
|
||||||
dispatch(muteStatus(status.get('id')));
|
confirm: intl.formatMessage(messages.blockConfirm),
|
||||||
}
|
onConfirm: () => dispatch(blockAccount(account.get('id'))),
|
||||||
},
|
secondary: intl.formatMessage(messages.blockAndReport),
|
||||||
|
onSecondary: () => {
|
||||||
|
dispatch(blockAccount(account.get('id')));
|
||||||
|
dispatch(initReport(account, status));
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
|
||||||
onToggleHidden(status) {
|
onReport(status) {
|
||||||
if (status.get('hidden')) {
|
dispatch(initReport(status.get('account'), status));
|
||||||
dispatch(revealStatus(status.get('id')));
|
},
|
||||||
} else {
|
|
||||||
dispatch(hideStatus(status.get('id')));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
onGroupRemoveAccount(groupId, accountId) {
|
onMute(account) {
|
||||||
dispatch(createRemovedAccount(groupId, accountId));
|
dispatch(initMuteModal(account));
|
||||||
},
|
},
|
||||||
|
|
||||||
onGroupRemoveStatus(groupId, statusId) {
|
onMuteConversation(status) {
|
||||||
dispatch(groupRemoveStatus(groupId, statusId));
|
if (status.get('muted')) {
|
||||||
},
|
dispatch(unmuteStatus(status.get('id')));
|
||||||
|
} else {
|
||||||
|
dispatch(muteStatus(status.get('id')));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onDeactivateUser(status) {
|
onToggleHidden(status) {
|
||||||
dispatch(deactivateUserModal(intl, status.getIn(['account', 'id'])));
|
if (status.get('hidden')) {
|
||||||
},
|
dispatch(revealStatus(status.get('id')));
|
||||||
|
} else {
|
||||||
|
dispatch(hideStatus(status.get('id')));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onDeleteUser(status) {
|
onGroupRemoveAccount(groupId, accountId) {
|
||||||
dispatch(deleteUserModal(intl, status.getIn(['account', 'id'])));
|
dispatch(createRemovedAccount(groupId, accountId));
|
||||||
},
|
},
|
||||||
|
|
||||||
onDeleteStatus(status) {
|
onGroupRemoveStatus(groupId, statusId) {
|
||||||
dispatch(deleteStatusModal(intl, status.get('id')));
|
dispatch(groupRemoveStatus(groupId, statusId));
|
||||||
},
|
},
|
||||||
|
|
||||||
onToggleStatusSensitivity(status) {
|
onDeactivateUser(status) {
|
||||||
dispatch(toggleStatusSensitivityModal(intl, status.get('id'), status.get('sensitive')));
|
dispatch(deactivateUserModal(intl, status.getIn(['account', 'id'])));
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
onDeleteUser(status) {
|
||||||
|
dispatch(deleteUserModal(intl, status.getIn(['account', 'id'])));
|
||||||
|
},
|
||||||
|
|
||||||
|
onDeleteStatus(status) {
|
||||||
|
dispatch(deleteStatusModal(intl, status.get('id')));
|
||||||
|
},
|
||||||
|
|
||||||
|
onToggleStatusSensitivity(status) {
|
||||||
|
dispatch(toggleStatusSensitivityModal(intl, status.get('id'), status.get('sensitive')));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Status));
|
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Status));
|
||||||
|
|
Ładowanie…
Reference in New Issue