about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorOndřej Hruška <ondra@ondrovo.com>2017-10-05 21:55:02 +0200
committerOndřej Hruška <ondra@ondrovo.com>2017-10-05 21:55:02 +0200
commitf82e90bf11fd147c40f467a0d2eb0097d11898ac (patch)
treeb5324744a00b7675cd69baad6220f49dbcc7c863 /app
parentb1217242fc3949b9a9fbee3e654fd16a0abd8a03 (diff)
workaround for notif clearing
Diffstat (limited to 'app')
-rw-r--r--app/javascript/glitch/components/notification/container.js34
1 files changed, 13 insertions, 21 deletions
diff --git a/app/javascript/glitch/components/notification/container.js b/app/javascript/glitch/components/notification/container.js
index e29d6ba60..dc4c2168a 100644
--- a/app/javascript/glitch/components/notification/container.js
+++ b/app/javascript/glitch/components/notification/container.js
@@ -19,38 +19,30 @@ Imports:
 //  Package imports  //
 import { connect } from 'react-redux';
 
-//  Mastodon imports  //
-import { makeGetNotification } from '../../../mastodon/selectors';
-
 //  Our imports  //
 import Notification from '.';
 
 //  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
-/*
-
-State mapping:
---------------
+const mapStateToProps = (state, props) => {
+  // replace account id with object
+  let leNotif = props.notification.set('account', state.getIn(['accounts', props.notification.get('account')]));
 
-The `mapStateToProps()` function maps various state properties to the
-props of our component. We wrap this in `makeMapStateToProps()` so that
-we only have to call `makeGetNotification()` once instead of every
-time.
+  // populate markedForDelete from state - is mysteriously lost somewhere
+  for (let n of state.getIn(['notifications', 'items'])) {
+    if (n.get('id') === props.notification.get('id')) {
+      leNotif = leNotif.set('markedForDelete', n.get('markedForDelete'));
+      break;
+    }
+  }
 
-*/
-
-const makeMapStateToProps = () => {
-  const getNotification = makeGetNotification();
-
-  const mapStateToProps = (state, props) => ({
-    notification: getNotification(state, props.notification, props.accountId),
+  return ({
+    notification: leNotif,
     settings: state.get('local_settings'),
     notifCleaning: state.getIn(['notifications', 'cleaningMode']),
   });
-
-  return mapStateToProps;
 };
 
 //  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
-export default connect(makeMapStateToProps)(Notification);
+export default connect(mapStateToProps)(Notification);