Skip to content

Commit

Permalink
enhance(frontend): モデレーターがセンシティブ設定を変更する際に確認ダイアログを出すように (#15462)
Browse files Browse the repository at this point in the history
* enhance(frontend): モデレーターがセンシティブ設定を変更する際に確認ダイアログを出すように

* use MkSwitch

* Update Changelog
  • Loading branch information
kakkokari-gtyih authored Mar 3, 2025
1 parent 801a2ec commit 77667cf
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fix: システムアカウントが削除できる問題を修正

### Client
- Enhance: モデレーターがセンシティブ設定を変更する際に確認ダイアログを出すように
- Fix: 削除して編集の削除タイミングを投稿後になるように `#14498`

### Server
Expand Down
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5262,6 +5262,14 @@ export interface Locale extends ILocale {
* " {emoji} " をリアクションしますか?
*/
"reactAreYouSure": ParameterizedString<"emoji">;
/**
* このメディアをセンシティブとして設定しますか?
*/
"markAsSensitiveConfirm": string;
/**
* このメディアのセンシティブ指定を解除しますか?
*/
"unmarkAsSensitiveConfirm": string;
"_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 @@ -1311,6 +1311,8 @@ federationSpecified: "このサーバーはホワイトリスト連合で運用
federationDisabled: "このサーバーは連合が無効化されています。他のサーバーのユーザーとやり取りすることはできません。"
confirmOnReact: "リアクションする際に確認する"
reactAreYouSure: "\" {emoji} \" をリアクションしますか?"
markAsSensitiveConfirm: "このメディアをセンシティブとして設定しますか?"
unmarkAsSensitiveConfirm: "このメディアのセンシティブ指定を解除しますか?"

_accountSettings:
requireSigninToViewContents: "コンテンツの表示にログインを必須にする"
Expand Down
9 changes: 8 additions & 1 deletion packages/frontend/src/components/MkMediaAudio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,14 @@ function showMenu(ev: MouseEvent) {
});
}

function toggleSensitive(file: Misskey.entities.DriveFile) {
async function toggleSensitive(file: Misskey.entities.DriveFile) {
const { canceled } = await os.confirm({
type: 'warning',
text: file.isSensitive ? i18n.ts.unmarkAsSensitiveConfirm : i18n.ts.markAsSensitiveConfirm,
});

if (canceled) return;

os.apiWithDialog('drive/files/update', {
fileId: file.id,
isSensitive: !file.isSensitive,
Expand Down
16 changes: 13 additions & 3 deletions packages/frontend/src/components/MkMediaImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,21 @@ function showMenu(ev: MouseEvent) {

if (iAmModerator) {
menuItems.push({
text: i18n.ts.markAsSensitive,
text: props.image.isSensitive ? i18n.ts.unmarkAsSensitive : i18n.ts.markAsSensitive,
icon: 'ti ti-eye-exclamation',
danger: true,
action: () => {
os.apiWithDialog('drive/files/update', { fileId: props.image.id, isSensitive: true });
action: async () => {
const { canceled } = await os.confirm({
type: 'warning',
text: props.image.isSensitive ? i18n.ts.unmarkAsSensitiveConfirm : i18n.ts.markAsSensitiveConfirm,
});

if (canceled) return;

os.apiWithDialog('drive/files/update', {
fileId: props.image.id,
isSensitive: !props.image.isSensitive,
});
},
});
}
Expand Down
9 changes: 8 additions & 1 deletion packages/frontend/src/components/MkMediaVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,14 @@ function showMenu(ev: MouseEvent) {
});
}

function toggleSensitive(file: Misskey.entities.DriveFile) {
async function toggleSensitive(file: Misskey.entities.DriveFile) {
const { canceled } = await os.confirm({
type: 'warning',
text: file.isSensitive ? i18n.ts.unmarkAsSensitiveConfirm : i18n.ts.markAsSensitiveConfirm,
});

if (canceled) return;

os.apiWithDialog('drive/files/update', {
fileId: file.id,
isSensitive: !file.isSensitive,
Expand Down
21 changes: 17 additions & 4 deletions packages/frontend/src/pages/admin-file.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkA v-if="file.user" class="user" :to="`/admin/user/${file.user.id}`">
<MkUserCardMini :user="file.user"/>
</MkA>

<div>
<MkSwitch v-model="isSensitive" @update:modelValue="toggleIsSensitive">{{ i18n.ts.sensitive }}</MkSwitch>
<MkSwitch :modelValue="isSensitive" @update:modelValue="toggleSensitive">{{ i18n.ts.sensitive }}</MkSwitch>
</div>

<div>
Expand Down Expand Up @@ -117,9 +118,21 @@ async function del() {
});
}

async function toggleIsSensitive(v) {
await misskeyApi('drive/files/update', { fileId: props.fileId, isSensitive: v });
isSensitive.value = v;
async function toggleSensitive() {
if (!file.value) return;

const { canceled } = await os.confirm({
type: 'warning',
text: isSensitive.value ? i18n.ts.unmarkAsSensitiveConfirm : i18n.ts.markAsSensitiveConfirm,
});

if (canceled) return;
isSensitive.value = !isSensitive.value;

os.apiWithDialog('drive/files/update', {
fileId: file.value.id,
isSensitive: !file.value.isSensitive,
});
}

const headerActions = computed(() => [{
Expand Down

1 comment on commit 77667cf

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chromatic detects changes. Please review the changes on Chromatic.

Please sign in to comment.