fix: temp chat perm

This commit is contained in:
Timothy Jaeryang Baek 2025-12-06 08:02:12 -05:00
parent 2a8a2f1ba3
commit 508fde70ff
2 changed files with 26 additions and 17 deletions

View file

@ -902,8 +902,15 @@
const initNewChat = async () => {
console.log('initNewChat');
if ($user?.role !== 'admin' && $user?.permissions?.chat?.temporary_enforced) {
await temporaryChatEnabled.set(true);
if ($user?.role !== 'admin') {
if ($user?.permissions?.chat?.temporary_enforced) {
await temporaryChatEnabled.set(true);
}
if (!$user?.permissions?.chat?.temporary) {
await temporaryChatEnabled.set(false);
return;
}
}
if ($settings?.temporaryChatByDefault ?? false) {

View file

@ -713,24 +713,26 @@
</div>
</div>
<div>
<div class=" py-0.5 flex w-full justify-between">
<div id="temp-chat-default-label" class=" self-center text-xs">
{$i18n.t('Temporary Chat by Default')}
</div>
{#if $user.role === 'admin' || $user?.permissions?.chat?.temporary}
<div>
<div class=" py-0.5 flex w-full justify-between">
<div id="temp-chat-default-label" class=" self-center text-xs">
{$i18n.t('Temporary Chat by Default')}
</div>
<div class="flex items-center gap-2 p-1">
<Switch
ariaLabelledbyId="temp-chat-default-label"
tooltip={true}
bind:state={temporaryChatByDefault}
on:change={() => {
saveSettings({ temporaryChatByDefault });
}}
/>
<div class="flex items-center gap-2 p-1">
<Switch
ariaLabelledbyId="temp-chat-default-label"
tooltip={true}
bind:state={temporaryChatByDefault}
on:change={() => {
saveSettings({ temporaryChatByDefault });
}}
/>
</div>
</div>
</div>
</div>
{/if}
<div>
<div class=" py-0.5 flex w-full justify-between">