diff options
Diffstat (limited to 'webapp/stores')
-rw-r--r-- | webapp/stores/search_store.jsx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/webapp/stores/search_store.jsx b/webapp/stores/search_store.jsx index 62cc5635b..2ccf02f94 100644 --- a/webapp/stores/search_store.jsx +++ b/webapp/stores/search_store.jsx @@ -133,6 +133,19 @@ class SearchStoreClass extends EventEmitter { }); } } + + removePost(post) { + const results = this.getSearchResults(); + if (results == null) { + return; + } + + const index = results.order.indexOf(post.id); + if (index > -1) { + delete results.posts[post.id]; + results.order.splice(index, 1); + } + } } var SearchStore = new SearchStoreClass(); @@ -171,6 +184,10 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => { SearchStore.togglePinPost(action.reaction, false); SearchStore.emitSearchChange(); break; + case ActionTypes.REMOVE_POST: + SearchStore.removePost(action.post); + SearchStore.emitSearchChange(); + break; default: } }); |