From 5291b3dca2db1a6698e094870d523259ff93739d Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 12 Feb 2026 16:36:00 -0600 Subject: [PATCH] refac --- src/lib/components/channel/MessageInput.svelte | 6 ++---- src/lib/components/chat/MessageInput.svelte | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/lib/components/channel/MessageInput.svelte b/src/lib/components/channel/MessageInput.svelte index 2b6c2b96f..9cae9f31d 100644 --- a/src/lib/components/channel/MessageInput.svelte +++ b/src/lib/components/channel/MessageInput.svelte @@ -380,7 +380,7 @@ if (file['type'].startsWith('image/')) { const compressImageHandler = async (imageUrl, settings = {}, config = {}) => { // Quick shortcut so we don’t do unnecessary work. - const settingsCompression = settings?.imageCompression ?? false; + const settingsCompression = (settings?.imageCompression && settings?.imageCompressionInChannels) ?? false; const configWidth = config?.file?.image_compression?.width ?? null; const configHeight = config?.file?.image_compression?.height ?? null; @@ -420,9 +420,7 @@ let imageUrl = event.target.result; // Compress the image if settings or config require it - if ($settings?.imageCompression && $settings?.imageCompressionInChannels) { - imageUrl = await compressImageHandler(imageUrl, $settings, $config); - } + imageUrl = await compressImageHandler(imageUrl, $settings, $config); const blob = await (await fetch(imageUrl)).blob(); const compressedFile = new File([blob], file.name, { type: file.type }); diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 74898233e..47bdc6867 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -742,9 +742,7 @@ let imageUrl = event.target.result; // Compress the image if settings or config require it - if ($settings?.imageCompression && $settings?.imageCompressionInChannels) { - imageUrl = await compressImageHandler(imageUrl, $settings, $config); - } + imageUrl = await compressImageHandler(imageUrl, $settings, $config); if ($temporaryChatEnabled) { files = [