FIX: Use the register within the poll plugin
This commit is contained in:
parent
e3b47a3998
commit
d8a69e6bb2
|
@ -11,11 +11,11 @@ export function addDecorator(cb) {
|
|||
|
||||
export default class PostCooked {
|
||||
|
||||
constructor(attrs, getModel) {
|
||||
constructor(attrs, decoratorHelper) {
|
||||
this.attrs = attrs;
|
||||
this.expanding = false;
|
||||
this._highlighted = false;
|
||||
this.getModel = getModel;
|
||||
this.decoratorHelper = decoratorHelper;
|
||||
}
|
||||
|
||||
update(prev) {
|
||||
|
@ -31,7 +31,7 @@ export default class PostCooked {
|
|||
this._fixImageSizes($html);
|
||||
this._applySearchHighlight($html);
|
||||
|
||||
_decorators.forEach(cb => cb($html, this.getModel));
|
||||
_decorators.forEach(cb => cb($html, this.decoratorHelper));
|
||||
return $html[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { withPluginApi } from 'discourse/lib/plugin-api';
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
function createPollComponent(container, post, poll, vote) {
|
||||
const component = container.lookup("component:discourse-poll");
|
||||
function createPollComponent(register, post, poll, vote) {
|
||||
const component = register.lookup("component:discourse-poll");
|
||||
component.setProperties({ model: poll, vote, post });
|
||||
return component;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ function initializePolls(api) {
|
|||
const pollId = `${pollName}-${post.id}`;
|
||||
|
||||
const pollComponent = createPollComponent(
|
||||
helper.container,
|
||||
helper.register,
|
||||
post,
|
||||
polls[pollName],
|
||||
votes[pollName]
|
||||
|
|
Loading…
Reference in New Issue