summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-07-22 07:02:14 +0800
committerJoram Wilander <jwawilander@gmail.com>2017-07-21 19:02:14 -0400
commit58c6a70d3e225fcc423d4f0ee9316150e097b2c2 (patch)
tree90e688ea86a1db241b2d57aa9b3129563e34de90 /webapp/stores
parent816bfbeb91b9cd64a8a85dc37cc0e82554409c14 (diff)
downloadchat-58c6a70d3e225fcc423d4f0ee9316150e097b2c2.tar.gz
chat-58c6a70d3e225fcc423d4f0ee9316150e097b2c2.tar.bz2
chat-58c6a70d3e225fcc423d4f0ee9316150e097b2c2.zip
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
Diffstat (limited to 'webapp/stores')
-rw-r--r--webapp/stores/search_store.jsx19
1 files changed, 17 insertions, 2 deletions
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: