Merge branch 'reblogs-fix' into 'develop'

fix reblogs with confirmation modal enabled

See merge request soapbox-pub/soapbox-fe!948
strip-front-mentions
marcin mikołajczak 2022-01-03 16:40:31 +00:00
commit f596df3ec2
1 zmienionych plików z 142 dodań i 140 usunięć

Wyświetl plik

@ -66,8 +66,16 @@ const makeMapStateToProps = () => {
return mapStateToProps;
};
const mapDispatchToProps = (dispatch, { intl }) => ({
const mapDispatchToProps = (dispatch, { intl }) => {
function onModalReblog(status) {
if (status.get('reblogged')) {
dispatch(unreblog(status));
} else {
dispatch(reblog(status));
}
}
return {
onReply(status, router) {
dispatch((_, getState) => {
const state = getState();
@ -83,13 +91,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
});
},
onModalReblog(status) {
if (status.get('reblogged')) {
dispatch(unreblog(status));
} else {
dispatch(reblog(status));
}
},
onModalReblog,
onReblog(status, e) {
dispatch((_, getState) => {
@ -97,7 +99,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
if (e.shiftKey || !boostModal) {
this.onModalReblog(status);
} else {
dispatch(openModal('BOOST', { status, onReblog: this.onModalReblog }));
dispatch(openModal('BOOST', { status, onReblog: onModalReblog }));
}
});
},
@ -233,7 +235,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onToggleStatusSensitivity(status) {
dispatch(toggleStatusSensitivityModal(intl, status.get('id'), status.get('sensitive')));
},
});
};
};
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Status));