mirror of
https://github.com/discourse/discourse.git
synced 2026-08-09 12:38:21 -05:00
This reverts commit b0839ccf27.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import WidgetGlue from "discourse/widgets/glue";
|
||||
import { getRegister } from "discourse-common/lib/get-owner";
|
||||
import { bind, observes } from "discourse-common/utils/decorators";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
|
||||
const PLUGIN_ID = "discourse-poll";
|
||||
@@ -34,19 +34,16 @@ function initializePolls(api) {
|
||||
|
||||
subscribe() {
|
||||
this._super(...arguments);
|
||||
this.messageBus.subscribe(`/polls/${this.model.id}`, this._onPollMessage);
|
||||
this.messageBus.subscribe(`/polls/${this.model.id}`, (msg) => {
|
||||
const post = this.get("model.postStream").findLoadedPost(msg.post_id);
|
||||
post?.set("polls", msg.polls);
|
||||
});
|
||||
},
|
||||
|
||||
unsubscribe() {
|
||||
this.messageBus.unsubscribe("/polls/*", this._onPollMessage);
|
||||
this.messageBus.unsubscribe("/polls/*");
|
||||
this._super(...arguments);
|
||||
},
|
||||
|
||||
@bind
|
||||
_onPollMessage(msg) {
|
||||
const post = this.get("model.postStream").findLoadedPost(msg.post_id);
|
||||
post?.set("polls", msg.polls);
|
||||
},
|
||||
});
|
||||
|
||||
api.modifyClass("model:post", {
|
||||
|
||||
Reference in New Issue
Block a user