about summary refs log tree commit diff
path: root/app/javascript
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-05-11 21:54:47 +0200
committerGitHub <noreply@github.com>2017-05-11 21:54:47 +0200
commitd0ef318eaaf30bca53a1db605ced2e916f000c05 (patch)
treecd1e894ee767ca7117d2632db51a864ee0ba5caf /app/javascript
parent65f9db73b01012fd4944be9a56ba4a85407590aa (diff)
Fix #2205 - Delete associated notifications when a status is deleted (#2994)
Diffstat (limited to 'app/javascript')
-rw-r--r--app/javascript/mastodon/reducers/notifications.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js
index 6d53a0ae6..ae06b8267 100644
--- a/app/javascript/mastodon/reducers/notifications.js
+++ b/app/javascript/mastodon/reducers/notifications.js
@@ -10,6 +10,7 @@ import {
   NOTIFICATIONS_SCROLL_TOP
 } from '../actions/notifications';
 import { ACCOUNT_BLOCK_SUCCESS } from '../actions/accounts';
+import { TIMELINE_DELETE } from '../actions/timelines';
 import Immutable from 'immutable';
 
 const initialState = Immutable.Map({
@@ -87,6 +88,10 @@ const updateTop = (state, top) => {
   return state.set('top', top);
 };
 
+const deleteByStatus = (state, statusId) => {
+  return state.update('items', list => list.filterNot(item => item.get('status') === statusId));
+};
+
 export default function notifications(state = initialState, action) {
   switch(action.type) {
   case NOTIFICATIONS_REFRESH_REQUEST:
@@ -106,6 +111,8 @@ export default function notifications(state = initialState, action) {
     return filterNotifications(state, action.relationship);
   case NOTIFICATIONS_CLEAR:
     return state.set('items', Immutable.List()).set('next', null);
+  case TIMELINE_DELETE:
+    return deleteByStatus(state, action.id);
   default:
     return state;
   }