summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;