summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorVeraLyu <lvroyce0210@gmail.com>2017-04-13 05:28:35 +0800
committerCorey Hulen <corey@hulen.com>2017-04-12 14:28:35 -0700
commit59185babdc7acc950dd7c671404c1322e5b15333 (patch)
treebbcd89020d0575b58fec79da71f5b93d7812f78e /webapp
parent0aa84799fd41cf7c94dc4901095b0ee9f4c511b3 (diff)
downloadchat-59185babdc7acc950dd7c671404c1322e5b15333.tar.gz
chat-59185babdc7acc950dd7c671404c1322e5b15333.tar.bz2
chat-59185babdc7acc950dd7c671404c1322e5b15333.zip
PLT-4176: Remain RHS pin post unchanged after channel switching (#6038)
Prevent changes to search_store after switched channel so that RHS pin posts can continue to display previous content.
Diffstat (limited to 'webapp')
-rw-r--r--webapp/stores/search_store.jsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/webapp/stores/search_store.jsx b/webapp/stores/search_store.jsx
index 97e6a3b85..62cc5635b 100644
--- a/webapp/stores/search_store.jsx
+++ b/webapp/stores/search_store.jsx
@@ -5,6 +5,8 @@ import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import EventEmitter from 'events';
import Constants from 'utils/constants.jsx';
+import ChannelStore from 'stores/channel_store.jsx';
+
var ActionTypes = Constants.ActionTypes;
var CHANGE_EVENT = 'change';
@@ -140,6 +142,13 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => {
switch (action.type) {
case ActionTypes.RECEIVED_SEARCH:
+ if (SearchStore.getIsPinnedPosts() === action.is_pinned_posts &&
+ action.is_pinned_posts === true &&
+ SearchStore.getSearchResults().posts &&
+ ChannelStore.getCurrentId() !== Object.values(SearchStore.getSearchResults().posts)[0].channel_id) {
+ // ignore pin posts update after switch to a new channel
+ return;
+ }
SearchStore.storeSearchResults(action.results, action.is_mention_search, action.is_flagged_posts, action.is_pinned_posts);
SearchStore.emitSearchChange();
break;