upd: add info about multiple choices for polls

closes transfem-org/Sharkey#182
This commit is contained in:
Mar0xy 2023-11-30 22:16:42 +01:00
parent 7251f12908
commit 90ddbc5dcd
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
4 changed files with 21 additions and 6 deletions

View file

@ -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"

2
locales/index.d.ts vendored
View file

@ -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;

View file

@ -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: "パブリック"

View file

@ -17,6 +17,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</ul>
<p v-if="!readOnly" :class="$style.info">
<span>{{ i18n.t('_poll.totalVotes', { n: total }) }}</span>
<span v-if="note.poll.multiple"> · </span>
<span v-if="note.poll.multiple">{{ i18n.ts._poll.multiple }}</span>
<span> · </span>
<a v-if="!closed && !isVoted" style="color: inherit;" @click="showResult = !showResult">{{ showResult ? i18n.ts._poll.vote : i18n.ts._poll.showResult }}</a>
<span v-if="isVoted">{{ i18n.ts._poll.voted }}</span>
@ -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,