Merge branch 'scheduled' into 'develop'
Scheduled statuses improvements Closes #797 See merge request soapbox-pub/soapbox-fe!974
This commit is contained in:
commit
e1475e0ba5
|
@ -66,10 +66,12 @@ class ScheduledStatus extends ImmutablePureComponent {
|
|||
collapsable
|
||||
/>
|
||||
|
||||
{status.get('media_attachments').size > 0 && (
|
||||
<AttachmentThumbs
|
||||
compact
|
||||
media={status.get('media_attachments')}
|
||||
/>
|
||||
)}
|
||||
|
||||
{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 { defineMessages, injectIntl } from 'react-intl';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { openModal } from 'soapbox/actions/modal';
|
||||
import { cancelScheduledStatus } from 'soapbox/actions/scheduled_statuses';
|
||||
import { getSettings } from 'soapbox/actions/settings';
|
||||
|
||||
const messages = defineMessages({
|
||||
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 => {
|
||||
|
@ -19,8 +24,26 @@ const mapStateToProps = state => {
|
|||
};
|
||||
};
|
||||
|
||||
export default @connect(mapStateToProps, null, null, { forwardRef: true })
|
||||
@injectIntl
|
||||
const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||
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 {
|
||||
|
||||
static contextTypes = {
|
||||
|
@ -31,11 +54,13 @@ class ScheduledStatusActionBar extends ImmutablePureComponent {
|
|||
status: ImmutablePropTypes.map.isRequired,
|
||||
intl: PropTypes.object.isRequired,
|
||||
me: SoapboxPropTypes.me,
|
||||
onCancelClick: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
handleCancelClick = e => {
|
||||
const { status, dispatch } = this.props;
|
||||
dispatch(cancelScheduledStatus(status.get('id')));
|
||||
const { status, onCancelClick } = this.props;
|
||||
|
||||
onCancelClick(status);
|
||||
}
|
||||
|
||||
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.reply.confirm": "Odpowiedz",
|
||||
"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.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!",
|
||||
|
|
|
@ -300,8 +300,10 @@ const handleExpandFail = (state, timelineId) => {
|
|||
export default function timelines(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case STATUS_CREATE_REQUEST:
|
||||
if (action.params.scheduled_at) return state;
|
||||
return importPendingStatus(state, action.params, action.idempotencyKey);
|
||||
case STATUS_CREATE_SUCCESS:
|
||||
if (action.status.scheduled_at) return state;
|
||||
return importStatus(state, action.status, action.idempotencyKey);
|
||||
case TIMELINE_EXPAND_REQUEST:
|
||||
return setLoading(state, action.timeline, true);
|
||||
|
|
Loading…
Reference in New Issue