about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/notifications
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-04-23 04:39:50 +0200
committerGitHub <noreply@github.com>2017-04-23 04:39:50 +0200
commit59b1de0bcf39473106e5380c129d7436be1ad89a (patch)
tree348ac6a815dafa69baea150c2e69be3274fbdc3f /app/assets/javascripts/components/features/notifications
parentdf46864b39b0ba26aedb65d2984b9be08ff5e35a (diff)
Add a confirmation modal: (#2279)
- Deleting a toot
- Muting, blocking someone
- Clearing notifications

Remove source map generation from development environment, as it is a huge
performance sink hole with little gains
Diffstat (limited to 'app/assets/javascripts/components/features/notifications')
-rw-r--r--app/assets/javascripts/components/features/notifications/index.jsx14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/assets/javascripts/components/features/notifications/index.jsx b/app/assets/javascripts/components/features/notifications/index.jsx
index 7b9b6d9e4..14c00b9ce 100644
--- a/app/assets/javascripts/components/features/notifications/index.jsx
+++ b/app/assets/javascripts/components/features/notifications/index.jsx
@@ -11,10 +11,12 @@ import { createSelector } from 'reselect';
 import Immutable from 'immutable';
 import LoadMore from '../../components/load_more';
 import ClearColumnButton from './components/clear_column_button';
+import { openModal } from '../../actions/modal';
 
 const messages = defineMessages({
   title: { id: 'column.notifications', defaultMessage: 'Notifications' },
-  confirm: { id: 'notifications.clear_confirmation', defaultMessage: 'Are you sure you want to clear all your notifications?' }
+  clearMessage: { id: 'notifications.clear_confirmation', defaultMessage: 'Are you sure you want to permanently clear all your notifications?' },
+  clearConfirm: { id: 'notifications.clear', defaultMessage: 'Clear notifications' }
 });
 
 const getNotifications = createSelector([
@@ -64,9 +66,13 @@ class Notifications extends React.PureComponent {
   }
 
   handleClear () {
-    if (window.confirm(this.props.intl.formatMessage(messages.confirm))) {
-      this.props.dispatch(clearNotifications());
-    }
+    const { dispatch, intl } = this.props;
+
+    dispatch(openModal('CONFIRM', {
+      message: intl.formatMessage(messages.clearMessage),
+      confirm: intl.formatMessage(messages.clearConfirm),
+      onConfirm: () => dispatch(clearNotifications())
+    }));
   }
 
   setRef (c) {