mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-29 06:32:52 +00:00
fix: compress images in channels setting shows while channels are off (#32976)
Settings > Interface offered "Compress Images in Channels" when channels are turned off for the instance or the user may not use them. It now only shows when the user can use channels, the same way the sidebar decides whether to list them, and the settings search skips it otherwise. A saved choice is kept. Refs #32830
This commit is contained in:
parent
be8f2c0a21
commit
fbad6fb252
2 changed files with 11 additions and 2 deletions
|
|
@ -1,5 +1,9 @@
|
|||
<script lang="ts">
|
||||
import { canUseTemporaryChats, isSettingsAdmin } from '$lib/utils/settings-access';
|
||||
import {
|
||||
canUseChannels,
|
||||
canUseTemporaryChats,
|
||||
isSettingsAdmin
|
||||
} from '$lib/utils/settings-access';
|
||||
import { config, settings, user } from '$lib/stores';
|
||||
import { onMount, getContext } from 'svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
|
|
@ -2100,7 +2104,7 @@
|
|||
</p>
|
||||
</div>
|
||||
|
||||
{#if imageCompression}
|
||||
{#if imageCompression && canUseChannels({ user: $user, config: $config })}
|
||||
<div>
|
||||
<div class={settingRowClass}>
|
||||
<label
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ export const canUseNotificationTargets = ({ user, config }: SettingsAccessContex
|
|||
(user?.role === 'admin' || (user?.permissions?.features?.webhooks ?? false));
|
||||
export const canUseTemporaryChats = ({ user }: SettingsAccessContext) =>
|
||||
user?.role === 'admin' || user?.permissions?.chat?.temporary;
|
||||
export const canUseChannels = ({ user, config }: SettingsAccessContext) =>
|
||||
config?.features?.enable_channels &&
|
||||
(user?.role === 'admin' || (user?.permissions?.features?.channels ?? true));
|
||||
export const isSettingsAdmin = ({ user }: SettingsAccessContext) => user?.role === 'admin';
|
||||
|
||||
/** Only permission-gated text needs an explicit rule. Provider/disclosure state is irrelevant. */
|
||||
|
|
@ -65,5 +68,7 @@ export function canSearchSetting(
|
|||
return isSettingsAdmin(context);
|
||||
if (stem === 'settings.personal.interface.temporaryChatByDefault')
|
||||
return !!canUseTemporaryChats(context);
|
||||
if (stem === 'settings.personal.interface.compressImagesInChannels')
|
||||
return !!canUseChannels(context);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue