mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: Make sure model is updated when polls change.
This commit is contained in:
parent
dd3ddce448
commit
7aac5baeed
1 changed files with 6 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
import computed from "ember-addons/ember-computed-decorators";
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
|
import { observes } from "ember-addons/ember-computed-decorators";
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
isMultiple: Ember.computed.equal("poll.type", "multiple"),
|
isMultiple: Ember.computed.equal("poll.type", "multiple"),
|
||||||
|
@ -15,6 +16,11 @@ export default Ember.Controller.extend({
|
||||||
showResultsDisabled: Em.computed.equal("poll.voters", 0),
|
showResultsDisabled: Em.computed.equal("poll.voters", 0),
|
||||||
hideResultsDisabled: Em.computed.or("isClosed", "post.topic.archived"),
|
hideResultsDisabled: Em.computed.or("isClosed", "post.topic.archived"),
|
||||||
|
|
||||||
|
@observes("post.polls")
|
||||||
|
_updatePoll() {
|
||||||
|
this.set("model", this.get("post.pollsObject")[this.get("model.name")]);
|
||||||
|
},
|
||||||
|
|
||||||
@computed("model", "vote", "model.voters", "model.options", "model.status")
|
@computed("model", "vote", "model.voters", "model.options", "model.status")
|
||||||
poll(poll, vote) {
|
poll(poll, vote) {
|
||||||
if (poll) {
|
if (poll) {
|
||||||
|
|
Loading…
Reference in a new issue