Resolve "Polling: Updated poll admin UX"

This commit is contained in:
N Pex 2022-06-08 18:53:50 +00:00
parent b1d11be82b
commit c01da6f420
11 changed files with 1531 additions and 1111 deletions

View file

@ -11,6 +11,7 @@ export default {
pollEndTs: null,
pollIsDisclosed: true,
pollTentativeAnswer: null,
pollViewResults: false,
};
},
mounted() {
@ -145,8 +146,13 @@ export default {
this.pollTotalVotes = totalVotes;
},
pollAnswer(id) {
if (!this.userHasVoted) {
this.pollTentativeAnswer = id;
// Only if not voted and not currently viewing poll results.
if (!this.userHasVoted && !this.pollViewResults) {
if (id == this.pollTentativeAnswer) {
this.pollTentativeAnswer = null;
} else {
this.pollTentativeAnswer = id;
}
}
},
pollAnswerSubmit() {
@ -163,7 +169,9 @@ export default {
});
},
pollClose() {
util.closePoll(this.$matrix.matrixClient, this.room.roomId, this.event).catch((err) => {
util.closePoll(this.$matrix.matrixClient, this.room.roomId, this.event).then(() => {
this.$emit("poll-closed", this);
}).catch((err) => {
console.log("Failed to send:", err);
});
},