From 58c6a70d3e225fcc423d4f0ee9316150e097b2c2 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Sat, 22 Jul 2017 07:02:14 +0800 Subject: Add [...] menu to search results list (#6663) * Add [...] menu to search results list * fix updates on search results when post is pinned or edited * remove app dispatcher from component --- webapp/stores/search_store.jsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'webapp/stores') diff --git a/webapp/stores/search_store.jsx b/webapp/stores/search_store.jsx index 7c9c4b8ef..5dfea6867 100644 --- a/webapp/stores/search_store.jsx +++ b/webapp/stores/search_store.jsx @@ -120,6 +120,17 @@ class SearchStoreClass extends EventEmitter { } } + updatePost(post) { + const results = this.getSearchResults(); + if (results == null) { + return; + } + + if (post.id in results.posts) { + results.posts[post.id] = Object.assign({}, post); + } + } + togglePinPost(postId, isPinned) { const results = this.getSearchResults(); if (results == null || results.posts == null) { @@ -176,12 +187,16 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => { SearchStore.deletePost(action.post); SearchStore.emitSearchChange(); break; + case ActionTypes.POST_UPDATED: + SearchStore.updatePost(action.post); + SearchStore.emitSearchChange(); + break; case ActionTypes.RECEIVED_POST_PINNED: - SearchStore.togglePinPost(action.reaction, true); + SearchStore.togglePinPost(action.postId, true); SearchStore.emitSearchChange(); break; case ActionTypes.RECEIVED_POST_UNPINNED: - SearchStore.togglePinPost(action.reaction, false); + SearchStore.togglePinPost(action.postId, false); SearchStore.emitSearchChange(); break; case ActionTypes.REMOVE_POST: -- cgit v1.2.3-1-g7c22