Deleted posts now update in search results and flagged posts (#4618)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
48d64f3f68
Коммит
3c65a20f45
@@ -96,6 +96,21 @@ class SearchStoreClass extends EventEmitter {
|
||||
this.isMentionSearch = isMentionSearch;
|
||||
this.isFlaggedPosts = isFlaggedPosts;
|
||||
}
|
||||
|
||||
deletePost(post) {
|
||||
const results = this.getSearchResults();
|
||||
if (results == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (post.id in results.posts) {
|
||||
// make sure to copy the post so that component state changes work properly
|
||||
results.posts[post.id] = Object.assign({}, post, {
|
||||
state: Constants.POST_DELETED,
|
||||
file_ids: []
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var SearchStore = new SearchStoreClass();
|
||||
@@ -115,6 +130,10 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => {
|
||||
case ActionTypes.SHOW_SEARCH:
|
||||
SearchStore.emitShowSearch();
|
||||
break;
|
||||
case ActionTypes.POST_DELETED:
|
||||
SearchStore.deletePost(action.post);
|
||||
SearchStore.emitSearchChange();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
});
|
||||
|
||||
Ссылка в новой задаче
Block a user