mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FEATURE: Add public type to polls.
This commit is contained in:
@ -6,6 +6,7 @@ export default Ember.Controller.extend({
|
||||
isNumber: Ember.computed.equal("poll.type", "number"),
|
||||
isRandom : Ember.computed.equal("poll.order", "random"),
|
||||
isClosed: Ember.computed.equal("poll.status", "closed"),
|
||||
pollsVoters: Ember.computed.alias("post.polls_voters"),
|
||||
|
||||
// shows the results when
|
||||
// - poll is closed
|
||||
@ -145,8 +146,16 @@ export default Ember.Controller.extend({
|
||||
options: this.get("selectedOptions"),
|
||||
}
|
||||
}).then(results => {
|
||||
this.setProperties({ vote: results.vote, showResults: true });
|
||||
this.set("model", Em.Object.create(results.poll));
|
||||
const poll = results.poll;
|
||||
const votes = results.vote;
|
||||
const currentUser = this.currentUser;
|
||||
|
||||
this.setProperties({ vote: votes, showResults: true });
|
||||
this.set("model", Em.Object.create(poll));
|
||||
|
||||
if (poll.public) {
|
||||
this.get("pollsVoters")[currentUser.get("id")] = currentUser;
|
||||
}
|
||||
}).catch(() => {
|
||||
bootbox.alert(I18n.t("poll.error_while_casting_votes"));
|
||||
}).finally(() => {
|
||||
|
Reference in New Issue
Block a user