2 import { connect
} from 'react-redux';
3 import { defineMessages
, injectIntl
} from 'react-intl';
6 import NotificationPurgeButtons
from 'flavours/glitch/components/notification_purge_buttons';
8 deleteMarkedNotifications
,
9 enterNotificationClearingMode
,
11 } from 'flavours/glitch/actions/notifications';
12 import { openModal
} from 'flavours/glitch/actions/modal';
14 const messages
= defineMessages({
15 clearMessage: { id: 'notifications.marked_clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all selected notifications?' },
16 clearConfirm: { id: 'notifications.marked_clear', defaultMessage: 'Clear selected notifications' },
19 const mapDispatchToProps
= (dispatch
, { intl
}) => ({
20 onEnterCleaningMode(yes
) {
21 dispatch(enterNotificationClearingMode(yes
));
25 dispatch(openModal('CONFIRM', {
26 message: intl
.formatMessage(messages
.clearMessage
),
27 confirm: intl
.formatMessage(messages
.clearConfirm
),
28 onConfirm: () => dispatch(deleteMarkedNotifications()),
33 dispatch(markAllNotifications(true));
37 dispatch(markAllNotifications(false));
41 dispatch(markAllNotifications(null));
45 const mapStateToProps
= state
=> ({
46 markNewForDelete: state
.getIn(['notifications', 'markNewForDelete']),
49 export default injectIntl(connect(mapStateToProps
, mapDispatchToProps
)(NotificationPurgeButtons
));