From 561b0fc10e83f6187491c938037ef3bcfcb56f5c Mon Sep 17 00:00:00 2001 From: syuilo <Syuilotan@yahoo.co.jp> Date: Sun, 28 Nov 2021 20:23:48 +0900 Subject: [PATCH] feat(client): show confirm dialog when vote --- CHANGELOG.md | 1 + locales/ja-JP.yml | 1 + packages/client/src/components/poll.vue | 14 ++++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d73758d8e9..ba346f762b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ ### Improvements - API: /antennas/notes API ã§æ—¥ä»˜ã«ã‚ˆã‚‹çµžã‚Šè¾¼ã¿ãŒã§ãるよã†ã« +- クライアント: アンケートã«æŠ•ç¥¨ã™ã‚‹éš›ã«ç¢ºèªãƒ€ã‚¤ã‚¢ãƒã‚°ã‚’出ã™ã‚ˆã†ã« ### Bugfixes - クライアント: ãƒã‚°ã‚¤ãƒ³ã«ãŠã„ã¦ãƒ‘スワードãŒèª¤ã£ã¦ã„ã‚‹éš›ã®ã‚¨ãƒ©ãƒ¼ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ãŒæ£ã—ã表示ã•ã‚Œãªã„å•é¡Œã‚’ä¿®æ£ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 77b7a2cf27..d5fcd2d406 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -809,6 +809,7 @@ ffVisibilityDescription: "自分ã®ãƒ•ã‚©ãƒãƒ¼/フォãƒãƒ¯ãƒ¼æƒ…å ±ã®å…¬é–‹ continueThread: "ã•ã‚‰ã«ã‚¹ãƒ¬ãƒƒãƒ‰ã‚’見る" deleteAccountConfirm: "アカウントãŒå‰Šé™¤ã•ã‚Œã¾ã™ã€‚よã‚ã—ã„ã§ã™ã‹ï¼Ÿ" incorrectPassword: "パスワードãŒé–“é•ã£ã¦ã„ã¾ã™ã€‚" +voteConfirm: "「{choice}ã€ã«æŠ•ç¥¨ã—ã¾ã™ã‹ï¼Ÿ" _emailUnavailable: used: "æ—¢ã«ä½¿ç”¨ã•ã‚Œã¦ã„ã¾ã™" diff --git a/packages/client/src/components/poll.vue b/packages/client/src/components/poll.vue index 6dbe0c84e9..20a9900258 100644 --- a/packages/client/src/components/poll.vue +++ b/packages/client/src/components/poll.vue @@ -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; } } }); -- GitLab