auto-remove stale user/team roles

This commit is contained in:
Harsh Mahajan committed 2025-11-05 12:51:37 +05:30
1 parent 4f6919505c
commit d36135f5b7
2 files changed
+17 -2

No files matched your search

@@ -139,7 +139,7 @@
{#each [...$groups] as [role, permission] (role)}
<Table.Row.Base {root}>
<Table.Cell column="role" {root}>
<Row {role} />
<Row {role} on:notFound={() => deleteRole(role)} />
</Table.Cell>
<Table.Cell column="create" {root}>
<Selector.Checkbox
+16 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { type ComponentProps, type Snippet } from 'svelte';
import { type ComponentProps, type Snippet, createEventDispatcher, onMount } from 'svelte';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@appwrite.io/console';
import { AvatarInitials } from '../';
@@ -38,6 +38,8 @@
let { role, placement = 'bottom-start', children }: Props = $props();
const dispatch = createEventDispatcher<{ notFound: string }>();
type ParsedPermission = {
type: 'user' | 'team' | 'other';
id: string;
@@ -111,6 +113,19 @@
return fetchPromise;
}
async function verifyExistence() {
try {
const data = await getData(role);
if (data?.notFound) {
dispatch('notFound', role);
}
} catch {}
}
onMount(() => {
verifyExistence();
});
let isMouseOverTooltip = $state(false);
function hidePopover(hideTooltip: () => void, timeout = true) {
if (!timeout) {