diff options
Diffstat (limited to 'webapp/stores/search_store.jsx')
-rw-r--r-- | webapp/stores/search_store.jsx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/webapp/stores/search_store.jsx b/webapp/stores/search_store.jsx index d1458ceed..46a086ddb 100644 --- a/webapp/stores/search_store.jsx +++ b/webapp/stores/search_store.jsx @@ -96,6 +96,21 @@ class SearchStoreClass extends EventEmitter { this.isMentionSearch = isMentionSearch; this.isFlaggedPosts = isFlaggedPosts; } + + deletePost(post) { + const results = this.getSearchResults(); + if (results == null) { + return; + } + + if (post.id in results.posts) { + // make sure to copy the post so that component state changes work properly + results.posts[post.id] = Object.assign({}, post, { + state: Constants.POST_DELETED, + file_ids: [] + }); + } + } } var SearchStore = new SearchStoreClass(); @@ -115,6 +130,10 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => { case ActionTypes.SHOW_SEARCH: SearchStore.emitShowSearch(); break; + case ActionTypes.POST_DELETED: + SearchStore.deletePost(action.post); + SearchStore.emitSearchChange(); + break; default: } }); |