enhance(frontend): チャットルームを削除できるように

This commit is contained in:
syuilo 2025-03-25 09:30:14 +09:00
parent 5d3e8253c4
commit 2370b55a27
3 changed files with 22 additions and 0 deletions

4
locales/index.d.ts vendored
View File

@ -5452,6 +5452,10 @@ export interface Locale extends ILocale {
* *
*/ */
"muteThisRoom": string; "muteThisRoom": string;
/**
*
*/
"deleteRoom": string;
/** /**
* *
*/ */

View File

@ -1360,6 +1360,7 @@ _chat:
searchMessages: "メッセージを検索" searchMessages: "メッセージを検索"
home: "ホーム" home: "ホーム"
muteThisRoom: "このルームをミュート" muteThisRoom: "このルームをミュート"
deleteRoom: "ルームを削除"
cannotChatWithTheUser: "このユーザーとのチャットを開始できません" cannotChatWithTheUser: "このユーザーとのチャットを開始できません"
cannotChatWithTheUser_description: "チャットが使えない状態になっているか、相手がチャットを開放していません。" cannotChatWithTheUser_description: "チャットが使えない状態になっているか、相手がチャットを開放していません。"
chatWithThisUser: "チャットする" chatWithThisUser: "チャットする"

View File

@ -17,6 +17,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<hr> <hr>
<MkButton v-if="isOwner" danger @click="del">{{ i18n.ts._chat.deleteRoom }}</MkButton>
<MkSwitch v-if="!isOwner" v-model="isMuted"> <MkSwitch v-if="!isOwner" v-model="isMuted">
<template #label>{{ i18n.ts._chat.muteThisRoom }}</template> <template #label>{{ i18n.ts._chat.muteThisRoom }}</template>
</MkSwitch> </MkSwitch>
@ -34,7 +36,9 @@ import { ensureSignin } from '@/i.js';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue'; import MkTextarea from '@/components/MkTextarea.vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import { useRouter } from '@/router.js';
const router = useRouter();
const $i = ensureSignin(); const $i = ensureSignin();
const props = defineProps<{ const props = defineProps<{
@ -56,6 +60,19 @@ function save() {
}); });
} }
async function del() {
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.ts.areYouSure,
});
if (canceled) return;
misskeyApi('chat/rooms/delete', {
roomId: props.room.id,
});
router.push('/chat');
}
const isMuted = ref(props.room.isMuted); const isMuted = ref(props.room.isMuted);
watch(isMuted, async () => { watch(isMuted, async () => {