PLT-6155: Keep pin badges in RHS consistent with that in center (#6018)
Sync search store when recieving pin/unpin event to keep pin badges in RHS consistent with that in center channel.
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
a10ad339d1
Коммит
03502cf73b
@@ -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:
|
||||
}
|
||||
});
|
||||
|
||||
Ссылка в новой задаче
Block a user