|
74 | 74 |
|
75 | 75 | $: models = selectedModels.map((id) => $_models.find((m) => m.id === id)); |
76 | 76 |
|
77 | | - // True when viewing a shared folder the current user doesn't own |
78 | | - $: folderReadOnly = $selectedFolder != null && $selectedFolder.user_id !== $user?.id; |
| 77 | + // True when viewing a shared folder the current user doesn't own AND lacks write access |
| 78 | + $: folderReadOnly = |
| 79 | + $selectedFolder != null && |
| 80 | + $selectedFolder.user_id !== $user?.id && |
| 81 | + $selectedFolder.permission !== 'write'; |
| 82 | +
|
| 83 | + // True when the current user does NOT own this folder (hide management menus) |
| 84 | + $: folderNotOwned = $selectedFolder != null && $selectedFolder.user_id !== $user?.id; |
79 | 85 | </script> |
80 | 86 |
|
81 | 87 | <div class="m-auto w-full max-w-6xl px-2 @2xl:px-20 translate-y-6 py-24 text-center"> |
|
97 | 103 | <div class="w-full flex flex-col justify-center items-center"> |
98 | 104 | {#if $selectedFolder} |
99 | 105 | <FolderTitle |
100 | | - folder={$selectedFolder} |
101 | | - readOnly={folderReadOnly} |
102 | | - onUpdate={async (folder) => { |
103 | | - await chats.set(await getChatList(localStorage.token, $currentChatPage)); |
104 | | - currentChatPage.set(1); |
105 | | - }} |
106 | | - onDelete={async () => { |
107 | | - await chats.set(await getChatList(localStorage.token, $currentChatPage)); |
108 | | - currentChatPage.set(1); |
| 106 | + folder={$selectedFolder} |
| 107 | + readOnly={folderNotOwned} |
| 108 | + onUpdate={async (folder) => { |
| 109 | + await chats.set(await getChatList(localStorage.token, $currentChatPage)); |
| 110 | + currentChatPage.set(1); |
| 111 | + }} |
| 112 | + onDelete={async () => { |
| 113 | + await chats.set(await getChatList(localStorage.token, $currentChatPage)); |
| 114 | + currentChatPage.set(1); |
109 | 115 |
|
110 | | - selectedFolder.set(null); |
111 | | - }} |
112 | | - /> |
| 116 | + selectedFolder.set(null); |
| 117 | + }} |
| 118 | + /> |
113 | 119 | {:else} |
114 | 120 | <div class="flex flex-row justify-center gap-2.5 @sm:gap-3 w-fit px-5 max-w-xl"> |
115 | 121 | <div class="flex shrink-0 justify-center"> |
|
0 commit comments