Skip to content

Commit

Permalink
Merge 691fbc2 into a3f5cff
Browse files Browse the repository at this point in the history
  • Loading branch information
VeraLyu committed Apr 8, 2017
2 parents a3f5cff + 691fbc2 commit e056bd0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions webapp/stores/search_store.jsx
Expand Up @@ -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';
Expand Down Expand Up @@ -126,6 +128,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;
Expand Down

0 comments on commit e056bd0

Please sign in to comment.