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:
Classic298 2026-10-23 03:50:54 +02:00 • committed by GitHub
parent be8f2c0a21
commit fbad6fb252
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -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;
}