PLT-6240: Remove own pinned post from RHS when removed from channel (#6098)

Dispatch REMOVE_POST event after successfully initiating delete post,
others get informed by websocket event and will mark the msg as deleted
but not delete from RHS.
Этот коммит содержится в:
VeraLyu
2017-04-18 23:47:27 +08:00
коммит произвёл Corey Hulen
родитель d5ae46c96c
Коммит 8aab290d10
2 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@@ -133,6 +133,19 @@ class SearchStoreClass extends EventEmitter {
});
}
}
removePost(post) {
const results = this.getSearchResults();
if (results == null) {
return;
}
const index = results.order.indexOf(post.id);
if (index > -1) {
delete results.posts[post.id];
results.order.splice(index, 1);
}
}
}
var SearchStore = new SearchStoreClass();
@@ -171,6 +184,10 @@ SearchStore.dispatchToken = AppDispatcher.register((payload) => {
SearchStore.togglePinPost(action.reaction, false);
SearchStore.emitSearchChange();
break;
case ActionTypes.REMOVE_POST:
SearchStore.removePost(action.post);
SearchStore.emitSearchChange();
break;
default:
}
});