feat(console): confirm member and webhook removal

Removing a member, revoking an invite link and disabling a group's
webhook endpoint took effect on the first click. They now ask first;
disabling the webhook explains that senders still using the secret will
be rejected, and its button is styled as destructive.
This commit is contained in:
翅膀 committed 2026-10-17 00:29:51 +08:00
1 parent 24f5d0477c
commit 85f8cb74bc
5 files changed
+31 -3

No files matched your search

+13 -1
View File
@@ -94,6 +94,7 @@ import type { Group, GroupInvite, GroupMember, GroupRole } from "~/types";
import { useInvitesApi } from "~/composables/useInvites";
const { t } = useI18n();
const { confirm } = useConfirm();
const props = defineProps<{ group: Group; canEdit: boolean; saving: boolean }>();
const emit = defineEmits<{ (e: "save", group: Group): void }>();
@@ -156,11 +157,17 @@ function addMember(): void {
emitSave();
}
function removeMember(m: GroupMember): void {
async function removeMember(m: GroupMember): Promise<void> {
formError.value = "";
if (m.role === "owner" && ownerCount() === 1) {
formError.value = t("members.errLastOwner");
return;
}
const confirmed = await confirm({
title: t("confirm.removeMember", { name: m.login }),
confirmText: t("members.remove"),
});
if (!confirmed) return;
members.value = members.value.filter((x) => x !== m);
emitSave();
}
@@ -202,6 +209,11 @@ async function copyInvite(inv: GroupInvite): Promise<void> {
}
async function revoke(inv: GroupInvite): Promise<void> {
const confirmed = await confirm({
title: t("confirm.revokeInvite"),
confirmText: t("members.revoke"),
});
if (!confirmed) return;
try {
await invitesApi.revoke(inv.token);
invites.value = invites.value.filter((i) => i.token !== inv.token);
+8
View File
@@ -41,6 +41,7 @@
v-if="info.hasSecret"
type="button"
variant="ghost"
color="error"
size="sm"
:disabled="busy"
@click="onDisable"
@@ -67,6 +68,7 @@ import { ref, watch } from "vue";
import { useWebhookApi, type GroupWebhookInfo } from "~/composables/useWebhook";
const { t } = useI18n();
const { confirm } = useConfirm();
const props = defineProps<{ groupId: string; canEdit: boolean }>();
@@ -123,6 +125,12 @@ async function onRegenerate(): Promise<void> {
}
async function onDisable(): Promise<void> {
const confirmed = await confirm({
title: t("confirm.disableWebhook"),
description: t("confirm.disableWebhookDetail"),
confirmText: t("webhook.disable"),
});
if (!confirmed) return;
busy.value = true;
error.value = "";
try {