DEV: Minor code cleanup (#18225)

Various small changes made while debugging MessageBus-related tests.
This commit is contained in:
Jarek Radosz
2022-09-12 14:05:21 +02:00
committed by GitHub
parent ec32b61319
commit fa58eea64e
13 changed files with 82 additions and 86 deletions
@@ -31,15 +31,15 @@ function initializePolls(api) {
api.modifyClass("controller:topic", {
pluginId: PLUGIN_ID,
subscribe() {
this._super(...arguments);
this.messageBus.subscribe("/polls/" + this.get("model.id"), (msg) => {
this.messageBus.subscribe(`/polls/${this.model.id}`, (msg) => {
const post = this.get("model.postStream").findLoadedPost(msg.post_id);
if (post) {
post.set("polls", msg.polls);
}
post?.set("polls", msg.polls);
});
},
unsubscribe() {
this.messageBus.unsubscribe("/polls/*");
this._super(...arguments);