From 90ddbc5dcdb2d7377a7be316a16aa2e0fead6bbb Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Thu, 30 Nov 2023 22:16:42 +0100 Subject: [PATCH] upd: add info about multiple choices for polls closes transfem-org/Sharkey#182 --- locales/en-US.yml | 2 ++ locales/index.d.ts | 2 ++ locales/ja-JP.yml | 2 ++ packages/frontend/src/components/MkPoll.vue | 21 +++++++++++++++------ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 11b4e4e28f..e9c6d1cb3b 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -891,6 +891,7 @@ continueThread: "View thread continuation" deleteAccountConfirm: "This will irreversibly delete your account. Proceed?" incorrectPassword: "Incorrect password." voteConfirm: "Confirm your vote for \"{choice}\"?" +voteConfirmMulti: "Confirm your vote for \"{choice}\"?\n You can choose more options after confirmation." hide: "Hide" useDrawerReactionPickerForMobile: "Display reaction picker as drawer on mobile" welcomeBackWithName: "Welcome back, {name}" @@ -2007,6 +2008,7 @@ _poll: remainingHours: "{h} hour(s) {m} minute(s) remaining" remainingMinutes: "{m} minute(s) {s} second(s) remaining" remainingSeconds: "{s} second(s) remaining" + multiple: "Multiple choices" _visibility: public: "Public" publicDescription: "Your note will be visible for all users" diff --git a/locales/index.d.ts b/locales/index.d.ts index 27c647bdac..6aabc72732 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -894,6 +894,7 @@ export interface Locale { "deleteAccountConfirm": string; "incorrectPassword": string; "voteConfirm": string; + "voteConfirmMulti": string; "hide": string; "useDrawerReactionPickerForMobile": string; "welcomeBackWithName": string; @@ -2154,6 +2155,7 @@ export interface Locale { "remainingHours": string; "remainingMinutes": string; "remainingSeconds": string; + "multiple": string; }; "_visibility": { "public": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 23c3a12a66..98202a77e9 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -891,6 +891,7 @@ continueThread: "さらにスレッドを見る" deleteAccountConfirm: "アカウントが削除されます。よろしいですか?" incorrectPassword: "パスワードが間違っています。" voteConfirm: "「{choice}」に投票しますか?" +voteConfirmMulti: "「{choice}」に投票しますか?\n 確認後、選択肢を増やすことができます。" hide: "隠す" useDrawerReactionPickerForMobile: "モバイルデバイスのときドロワーで表示" welcomeBackWithName: "おかえりなさい、{name}さん" @@ -2058,6 +2059,7 @@ _poll: remainingHours: "終了まであと{h}時間{m}分" remainingMinutes: "終了まであと{m}分{s}秒" remainingSeconds: "終了まであと{s}秒" + multiple: "複数の選択肢" _visibility: public: "パブリック" diff --git a/packages/frontend/src/components/MkPoll.vue b/packages/frontend/src/components/MkPoll.vue index 2becabb41e..641b17d066 100644 --- a/packages/frontend/src/components/MkPoll.vue +++ b/packages/frontend/src/components/MkPoll.vue @@ -17,6 +17,8 @@ SPDX-License-Identifier: AGPL-3.0-only

{{ i18n.t('_poll.totalVotes', { n: total }) }} + · + {{ i18n.ts._poll.multiple }} · {{ showResult ? i18n.ts._poll.vote : i18n.ts._poll.showResult }} {{ i18n.ts._poll.voted }} @@ -78,12 +80,19 @@ const vote = async (id) => { pleaseLogin(); if (props.readOnly || closed.value || isVoted.value) return; - - const { canceled } = await os.confirm({ - type: 'question', - text: i18n.t('voteConfirm', { choice: props.note.poll.choices[id].text }), - }); - if (canceled) return; + if (!props.note.poll.multiple) { + const { canceled } = await os.confirm({ + type: 'question', + text: i18n.t('voteConfirm', { choice: props.note.poll.choices[id].text }), + }); + if (canceled) return; + } else { + const { canceled } = await os.confirm({ + type: 'question', + text: i18n.t('voteConfirmMulti', { choice: props.note.poll.choices[id].text }), + }); + if (canceled) return; + } await os.api('notes/polls/vote', { noteId: props.note.id,