Skip to content

Commit

Permalink
enhance(frontend): リアクション時に確認ダイアログを出せるように
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih committed Dec 25, 2024
1 parent a29ec49 commit 175240e
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 2 deletions.
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5258,6 +5258,14 @@ export interface Locale extends ILocale {
* 新規登録したユーザーに表示されるチュートリアルをスキップできないようにします。チュートリアルを完了しなかったりチュートリアルページを回避したりした場合でも、強制的にリダイレクトされます。
*/
"prohibitSkippingInitialTutorialDescription": string;
/**
* リアクションする際に確認する
*/
"confirmOnReact": string;
/**
* " {emoji} " をリアクションしますか?
*/
"reactAreYouSure": ParameterizedString<"emoji">;
"_accountSettings": {
/**
* コンテンツの表示にログインを必須にする
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,8 @@ reset: "リセット"
alwaysUseAbsoluteTime: "常に絶対時刻で表示する"
prohibitSkippingInitialTutorial: "チュートリアルをスキップできないようにする"
prohibitSkippingInitialTutorialDescription: "新規登録したユーザーに表示されるチュートリアルをスキップできないようにします。チュートリアルを完了しなかったりチュートリアルページを回避したりした場合でも、強制的にリダイレクトされます。"
confirmOnReact: "リアクションする際に確認する"
reactAreYouSure: "\" {emoji} \" をリアクションしますか?"

_accountSettings:
requireSigninToViewContents: "コンテンツの表示にログインを必須にする"
Expand Down
11 changes: 10 additions & 1 deletion packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,16 @@ function react(): void {
}
} else {
blur();
reactionPicker.show(reactButton.value ?? null, note.value, reaction => {
reactionPicker.show(reactButton.value ?? null, note.value, async (reaction) => {
if (defaultStore.state.confirmOnReact) {
const confirm = await os.confirm({
type: 'question',
text: i18n.tsx.reactAreYouSure({ emoji: reaction }),
});

if (confirm.canceled) return;
}

sound.playMisskeySfx('reaction');

if (props.mock) {
Expand Down
11 changes: 10 additions & 1 deletion packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,16 @@ function react(): void {
}
} else {
blur();
reactionPicker.show(reactButton.value ?? null, note.value, reaction => {
reactionPicker.show(reactButton.value ?? null, note.value, async (reaction) => {
if (defaultStore.state.confirmOnReact) {
const confirm = await os.confirm({
type: 'question',
text: i18n.tsx.reactAreYouSure({ emoji: reaction }),
});

if (confirm.canceled) return;
}

sound.playMisskeySfx('reaction');

misskeyApi('notes/reactions/create', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ async function toggleReaction() {
}
});
} else {
if (defaultStore.state.confirmOnReact) {
const confirm = await os.confirm({
type: 'question',
text: i18n.tsx.reactAreYouSure({ emoji: props.reaction }),
});

if (confirm.canceled) return;
}

sound.playMisskeySfx('reaction');

if (mock) {
Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/src/pages/settings/general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="enableHorizontalSwipe">{{ i18n.ts.enableHorizontalSwipe }}</MkSwitch>
<MkSwitch v-model="alwaysConfirmFollow">{{ i18n.ts.alwaysConfirmFollow }}</MkSwitch>
<MkSwitch v-model="confirmWhenRevealingSensitiveMedia">{{ i18n.ts.confirmWhenRevealingSensitiveMedia }}</MkSwitch>
<MkSwitch v-model="confirmOnReact">{{ i18n.ts.confirmOnReact }}</MkSwitch>
<MkSwitch v-model="alwaysUseAbsoluteTime">{{ i18n.ts.alwaysUseAbsoluteTime }}</MkSwitch>
</div>
<MkSelect v-model="serverDisconnectedBehavior">
Expand Down Expand Up @@ -322,6 +323,7 @@ const enableHorizontalSwipe = computed(defaultStore.makeGetterSetter('enableHori
const useNativeUIForVideoAudioPlayer = computed(defaultStore.makeGetterSetter('useNativeUIForVideoAudioPlayer'));
const alwaysConfirmFollow = computed(defaultStore.makeGetterSetter('alwaysConfirmFollow'));
const confirmWhenRevealingSensitiveMedia = computed(defaultStore.makeGetterSetter('confirmWhenRevealingSensitiveMedia'));
const confirmOnReact = computed(defaultStore.makeGetterSetter('confirmOnReact'));
const alwaysUseAbsoluteTime = computed(defaultStore.makeGetterSetter('alwaysUseAbsoluteTime'));
const contextMenu = computed(defaultStore.makeGetterSetter('contextMenu'));
const flowerEffect = computed(hanaStore.makeGetterSetter('flowerEffect'));
Expand Down
4 changes: 4 additions & 0 deletions packages/frontend/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: false,
},
confirmOnReact: {
where: 'device',
default: false,
},

sound_masterVolume: {
where: 'device',
Expand Down

0 comments on commit 175240e

Please sign in to comment.