mirror of
https://github.com/sim1222/misskey.git
synced 2025-08-03 15:06:27 +09:00
feat(client): show confirm dialog when vote
This commit is contained in:
@ -87,14 +87,20 @@ export default defineComponent({
|
||||
toggleShowResult() {
|
||||
this.showResult = !this.showResult;
|
||||
},
|
||||
vote(id) {
|
||||
async vote(id) {
|
||||
if (this.readOnly || this.closed || !this.poll.multiple && this.poll.choices.some(c => c.isVoted)) return;
|
||||
os.api('notes/polls/vote', {
|
||||
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'question',
|
||||
text: this.$t('voteConfirm', { choice: this.poll.choices[id].text }),
|
||||
});
|
||||
if (canceled) return;
|
||||
|
||||
await os.api('notes/polls/vote', {
|
||||
noteId: this.note.id,
|
||||
choice: id
|
||||
}).then(() => {
|
||||
if (!this.showResult) this.showResult = !this.poll.multiple;
|
||||
});
|
||||
if (!this.showResult) this.showResult = !this.poll.multiple;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user