sforkowany z mirror/soapbox
Merge branch 'scheduled' into 'develop'
Scheduled statuses improvements Closes #797 See merge request soapbox-pub/soapbox-fe!974party-hat
commit
e1475e0ba5
|
@ -145,7 +145,7 @@ const mapDispatchToProps = (dispatch, { intl }) => {
|
||||||
} else {
|
} else {
|
||||||
dispatch(openModal('CONFIRM', {
|
dispatch(openModal('CONFIRM', {
|
||||||
icon: withRedraft ? require('@tabler/icons/icons/edit.svg') : require('@tabler/icons/icons/trash.svg'),
|
icon: withRedraft ? require('@tabler/icons/icons/edit.svg') : require('@tabler/icons/icons/trash.svg'),
|
||||||
heading: intl.formatMessage(withRedraft ? messages.redraftHeading : messages.deleteHeading),
|
heading: intl.formatMessage(withRedraft ? messages.redraftHeading : messages.deleteHeading),
|
||||||
message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
|
message: intl.formatMessage(withRedraft ? messages.redraftMessage : messages.deleteMessage),
|
||||||
confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
|
confirm: intl.formatMessage(withRedraft ? messages.redraftConfirm : messages.deleteConfirm),
|
||||||
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
|
onConfirm: () => dispatch(deleteStatus(status.get('id'), history, withRedraft)),
|
||||||
|
|
|
@ -66,10 +66,12 @@ class ScheduledStatus extends ImmutablePureComponent {
|
||||||
collapsable
|
collapsable
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<AttachmentThumbs
|
{status.get('media_attachments').size > 0 && (
|
||||||
compact
|
<AttachmentThumbs
|
||||||
media={status.get('media_attachments')}
|
compact
|
||||||
/>
|
media={status.get('media_attachments')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{status.get('poll') && <PollPreview poll={status.get('poll')} />}
|
{status.get('poll') && <PollPreview poll={status.get('poll')} />}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,15 @@ import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types';
|
||||||
import IconButton from 'soapbox/components/icon_button';
|
import IconButton from 'soapbox/components/icon_button';
|
||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import { openModal } from 'soapbox/actions/modal';
|
||||||
import { cancelScheduledStatus } from 'soapbox/actions/scheduled_statuses';
|
import { cancelScheduledStatus } from 'soapbox/actions/scheduled_statuses';
|
||||||
|
import { getSettings } from 'soapbox/actions/settings';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
cancel: { id: 'scheduled_status.cancel', defaultMessage: 'Cancel' },
|
cancel: { id: 'scheduled_status.cancel', defaultMessage: 'Cancel' },
|
||||||
|
deleteConfirm: { id: 'confirmations.scheduled_status_delete.confirm', defaultMessage: 'Cancel' },
|
||||||
|
deleteHeading: { id: 'confirmations.scheduled_status_delete.heading', defaultMessage: 'Cancel scheduled post' },
|
||||||
|
deleteMessage: { id: 'confirmations.scheduled_status_delete.message', defaultMessage: 'Are you sure you want to cancel this scheduled post?' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
|
@ -19,8 +24,26 @@ const mapStateToProps = state => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default @connect(mapStateToProps, null, null, { forwardRef: true })
|
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
@injectIntl
|
onCancelClick: (status) => {
|
||||||
|
dispatch((_, getState) => {
|
||||||
|
|
||||||
|
const deleteModal = getSettings(getState()).get('deleteModal');
|
||||||
|
if (!deleteModal) {
|
||||||
|
dispatch(cancelScheduledStatus(status.get('id')));
|
||||||
|
} else {
|
||||||
|
dispatch(openModal('CONFIRM', {
|
||||||
|
icon: require('@tabler/icons/icons/calendar-stats.svg'),
|
||||||
|
heading: intl.formatMessage(messages.deleteHeading),
|
||||||
|
message: intl.formatMessage(messages.deleteMessage),
|
||||||
|
confirm: intl.formatMessage(messages.deleteConfirm),
|
||||||
|
onConfirm: () => dispatch(cancelScheduledStatus(status.get('id'))),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class ScheduledStatusActionBar extends ImmutablePureComponent {
|
class ScheduledStatusActionBar extends ImmutablePureComponent {
|
||||||
|
|
||||||
static contextTypes = {
|
static contextTypes = {
|
||||||
|
@ -31,11 +54,13 @@ class ScheduledStatusActionBar extends ImmutablePureComponent {
|
||||||
status: ImmutablePropTypes.map.isRequired,
|
status: ImmutablePropTypes.map.isRequired,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
me: SoapboxPropTypes.me,
|
me: SoapboxPropTypes.me,
|
||||||
|
onCancelClick: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
handleCancelClick = e => {
|
handleCancelClick = e => {
|
||||||
const { status, dispatch } = this.props;
|
const { status, onCancelClick } = this.props;
|
||||||
dispatch(cancelScheduledStatus(status.get('id')));
|
|
||||||
|
onCancelClick(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -56,3 +81,6 @@ class ScheduledStatusActionBar extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(ScheduledStatusActionBar));
|
||||||
|
|
|
@ -302,6 +302,9 @@
|
||||||
"confirmations.register.needs_confirmation": "Sprawdź swoją skrzynkę na {email}, aby znaleźć instrukcje potwierdzania. Musisz zweryfikować swój adres e-mail, aby kontynuować.",
|
"confirmations.register.needs_confirmation": "Sprawdź swoją skrzynkę na {email}, aby znaleźć instrukcje potwierdzania. Musisz zweryfikować swój adres e-mail, aby kontynuować.",
|
||||||
"confirmations.reply.confirm": "Odpowiedz",
|
"confirmations.reply.confirm": "Odpowiedz",
|
||||||
"confirmations.reply.message": "W ten sposób utracisz wpis który obecnie tworzysz. Czy na pewno chcesz to zrobić?",
|
"confirmations.reply.message": "W ten sposób utracisz wpis który obecnie tworzysz. Czy na pewno chcesz to zrobić?",
|
||||||
|
"confirmations.scheduled_status_delete.confirm": "Anuluj",
|
||||||
|
"confirmations.scheduled_status_delete.heading": "Anuluj zaplanowany wpis",
|
||||||
|
"confirmations.scheduled_status_delete.message": "Czy na pewno chcesz anulować ten zaplanowany wpis?",
|
||||||
"confirmations.unfollow.confirm": "Przestań śledzić",
|
"confirmations.unfollow.confirm": "Przestań śledzić",
|
||||||
"confirmations.unfollow.message": "Czy na pewno zamierzasz przestać śledzić {name}?",
|
"confirmations.unfollow.message": "Czy na pewno zamierzasz przestać śledzić {name}?",
|
||||||
"crypto_donate.explanation_box.message": "{siteTitle} przyjmuje darowizny w kryptowalutach. Możesz wysłać darowiznę na jeden z poniższych adresów. Dziękujemy za Wasze wsparcie!",
|
"crypto_donate.explanation_box.message": "{siteTitle} przyjmuje darowizny w kryptowalutach. Możesz wysłać darowiznę na jeden z poniższych adresów. Dziękujemy za Wasze wsparcie!",
|
||||||
|
|
|
@ -300,8 +300,10 @@ const handleExpandFail = (state, timelineId) => {
|
||||||
export default function timelines(state = initialState, action) {
|
export default function timelines(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case STATUS_CREATE_REQUEST:
|
case STATUS_CREATE_REQUEST:
|
||||||
|
if (action.params.scheduled_at) return state;
|
||||||
return importPendingStatus(state, action.params, action.idempotencyKey);
|
return importPendingStatus(state, action.params, action.idempotencyKey);
|
||||||
case STATUS_CREATE_SUCCESS:
|
case STATUS_CREATE_SUCCESS:
|
||||||
|
if (action.status.scheduled_at) return state;
|
||||||
return importStatus(state, action.status, action.idempotencyKey);
|
return importStatus(state, action.status, action.idempotencyKey);
|
||||||
case TIMELINE_EXPAND_REQUEST:
|
case TIMELINE_EXPAND_REQUEST:
|
||||||
return setLoading(state, action.timeline, true);
|
return setLoading(state, action.timeline, true);
|
||||||
|
|
Ładowanie…
Reference in New Issue