summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/stores')
-rw-r--r--webapp/stores/search_store.jsx22
1 files changed, 22 insertions, 0 deletions
diff --git a/webapp/stores/search_store.jsx b/webapp/stores/search_store.jsx
index d94c48f8a..97e6a3b85 100644
--- a/webapp/stores/search_store.jsx
+++ b/webapp/stores/search_store.jsx
@@ -117,6 +117,20 @@ class SearchStoreClass extends EventEmitter {
});
}
}
+
+ togglePinPost(postId, isPinned) {
+ const results = this.getSearchResults();
+ if (results == null) {
+ return;
+ }
+
+ if (postId in results.posts) {
+ const post = results.posts[postId];
+ results.posts[postId] = Object.assign({}, post, {
+ is_pinned: isPinned
+ });
+ }
+ }
}
var SearchStore = new SearchStoreClass();
@@ -140,6 +154,14 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => {
SearchStore.deletePost(action.post);
SearchStore.emitSearchChange();
break;
+ case ActionTypes.RECEIVED_POST_PINNED:
+ SearchStore.togglePinPost(action.reaction, true);
+ SearchStore.emitSearchChange();
+ break;
+ case ActionTypes.RECEIVED_POST_UNPINNED:
+ SearchStore.togglePinPost(action.reaction, false);
+ SearchStore.emitSearchChange();
+ break;
default:
}
});