Fix pinned posts not updating when list empty (#7164)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
58b2bcd907
Коммит
70157ef0e3
@@ -174,11 +174,14 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => {
|
|||||||
var action = payload.action;
|
var action = payload.action;
|
||||||
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case ActionTypes.RECEIVED_SEARCH:
|
case ActionTypes.RECEIVED_SEARCH: {
|
||||||
|
const results = SearchStore.getSearchResults() || {};
|
||||||
|
const posts = Object.values(results.posts || {});
|
||||||
|
const channelId = posts.length > 0 ? posts[0].channel_id : '';
|
||||||
if (SearchStore.getIsPinnedPosts() === action.is_pinned_posts &&
|
if (SearchStore.getIsPinnedPosts() === action.is_pinned_posts &&
|
||||||
action.is_pinned_posts === true &&
|
action.is_pinned_posts === true &&
|
||||||
SearchStore.getSearchResults().posts &&
|
channelId !== '' &&
|
||||||
ChannelStore.getCurrentId() !== Object.values(SearchStore.getSearchResults().posts)[0].channel_id) {
|
ChannelStore.getCurrentId() !== channelId) {
|
||||||
// ignore pin posts update after switch to a new channel
|
// ignore pin posts update after switch to a new channel
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -186,6 +189,7 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => {
|
|||||||
SearchStore.storeSearchResults(action.results, action.is_mention_search, action.is_flagged_posts, action.is_pinned_posts);
|
SearchStore.storeSearchResults(action.results, action.is_mention_search, action.is_flagged_posts, action.is_pinned_posts);
|
||||||
SearchStore.emitSearchChange();
|
SearchStore.emitSearchChange();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case ActionTypes.RECEIVED_SEARCH_TERM:
|
case ActionTypes.RECEIVED_SEARCH_TERM:
|
||||||
if (action.do_search) {
|
if (action.do_search) {
|
||||||
// while a search is in progress, hide results from previous search
|
// while a search is in progress, hide results from previous search
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user