From 90d4bedae878ce13dbfef79d21db5b8ddce22457 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 15 Jan 2025 23:08:54 -0800 Subject: [PATCH] enh: ability to set chat controls permissions --- .../components/chat/Controls/Controls.svelte | 112 +++++++++--------- .../chat/MessageInput/InputMenu.svelte | 2 +- src/lib/components/chat/Navbar.svelte | 4 +- 3 files changed, 62 insertions(+), 56 deletions(-) diff --git a/src/lib/components/chat/Controls/Controls.svelte b/src/lib/components/chat/Controls/Controls.svelte index 4ae63f77e..5b2a289e5 100644 --- a/src/lib/components/chat/Controls/Controls.svelte +++ b/src/lib/components/chat/Controls/Controls.svelte @@ -30,64 +30,70 @@ -
- {#if chatFiles.length > 0} - -
- {#each chatFiles as file, fileIdx} - { - // Remove the file from the chatFiles array + {#if $user.role === 'admin' || $user.permissions.chat?.controls} +
+ {#if chatFiles.length > 0} + +
+ {#each chatFiles as file, fileIdx} + { + // Remove the file from the chatFiles array - chatFiles.splice(fileIdx, 1); - chatFiles = chatFiles; - }} - on:click={() => { - console.log(file); - }} - /> - {/each} + chatFiles.splice(fileIdx, 1); + chatFiles = chatFiles; + }} + on:click={() => { + console.log(file); + }} + /> + {/each} +
+
+ +
+ {/if} + + +
+

- {/if} - -
- -
-
- -
- - -
-