refac
This commit is contained in:
1 parent
76854d1424
commit
084d040e22
5 files changed
+55
-30
No files matched your search
@@ -529,6 +529,16 @@
|
||||
on:focus={(e) => {}}
|
||||
draggable="false"
|
||||
>
|
||||
{#if ownerUserId}
|
||||
<Tooltip content={ownerName || 'Unknown'}>
|
||||
<img
|
||||
src="/api/v1/users/{ownerUserId}/profile/image"
|
||||
alt=""
|
||||
class="size-4 rounded-full shrink-0 object-cover mr-1.5"
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
<!-- Loading spinner for active chat (left side) -->
|
||||
{#if $activeChatIds.has(id)}
|
||||
<div class="shrink-0 self-center pr-2">
|
||||
@@ -537,15 +547,6 @@
|
||||
{/if}
|
||||
|
||||
<div class="flex self-center flex-1 w-full min-w-0">
|
||||
{#if ownerUserId}
|
||||
<Tooltip content={ownerName || 'Unknown'}>
|
||||
<img
|
||||
src="/api/v1/users/{ownerUserId}/profile/image"
|
||||
alt=""
|
||||
class="size-4 rounded-full shrink-0 object-cover mr-1.5"
|
||||
/>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
{#if unread}
|
||||
<div class="shrink-0 self-center pr-2.5 flex transition-opacity duration-300">
|
||||
<div class="size-1.5 bg-sky-500 rounded-full" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import Modal from '$lib/components/common/Modal.svelte';
|
||||
import AccessControl from '$lib/components/workspace/common/AccessControl.svelte';
|
||||
import XMark from '$lib/components/icons/XMark.svelte';
|
||||
import { updateFolderAccessById } from '$lib/apis/folders';
|
||||
import { getFolderById, updateFolderAccessById } from '$lib/apis/folders';
|
||||
import { user } from '$lib/stores';
|
||||
|
||||
type AccessGrant = {
|
||||
@@ -19,11 +19,28 @@
|
||||
export let folder: any = null;
|
||||
|
||||
let accessGrants: AccessGrant[] = [];
|
||||
let loading = false;
|
||||
|
||||
$: if (folder) {
|
||||
accessGrants = folder.access_grants ?? [];
|
||||
// Fetch fresh folder data (with access_grants) when modal opens
|
||||
$: if (show && folder?.id) {
|
||||
loadAccessGrants();
|
||||
}
|
||||
|
||||
const loadAccessGrants = async () => {
|
||||
loading = true;
|
||||
try {
|
||||
const freshFolder = await getFolderById(localStorage.token, folder.id);
|
||||
if (freshFolder) {
|
||||
accessGrants = freshFolder.access_grants ?? [];
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to load folder access grants', e);
|
||||
accessGrants = folder?.access_grants ?? [];
|
||||
} finally {
|
||||
loading = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleAccessChange = async () => {
|
||||
if (!folder) return;
|
||||
try {
|
||||
|
||||
@@ -549,7 +549,7 @@
|
||||
});
|
||||
|
||||
if (folder) {
|
||||
await selectedFolder.set(folder);
|
||||
await selectedFolder.set({ ...folders[folderId], ...folder });
|
||||
}
|
||||
|
||||
await goto('/');
|
||||
@@ -703,8 +703,8 @@
|
||||
createdAt={chat.created_at}
|
||||
updatedAt={chat.updated_at}
|
||||
lastReadAt={chat.last_read_at}
|
||||
ownerName={chat.owner_name ?? null}
|
||||
ownerUserId={chat.owner_name ? chat.user_id : null}
|
||||
ownerName={folders[folderId]?.shared ? (chat.owner_name ?? null) : null}
|
||||
ownerUserId={folders[folderId]?.shared && chat.owner_name ? chat.user_id : null}
|
||||
readonly={chat.user_id !== $user?.id}
|
||||
{shiftKey}
|
||||
on:change={(e) => {
|
||||
|
||||
Reference in new issue
Block a user