fix: rename bots → telegramBots in targets page to fix undefined reference

The variable was named `bots` but getBotName() referenced `telegramBots`,
causing a runtime crash and persistent loading on the targets page.
This commit is contained in:
2026-03-21 23:48:46 +03:00
parent 06b24638cb
commit 227b9c2e92
+3 -3
View File
@@ -62,7 +62,7 @@
let allTargets = $derived(targetsCache.items);
let activeType = $derived(page.url.searchParams.get('type') as TargetType | null);
let targets = $derived(activeType ? allTargets.filter(t => t.type === activeType) : allTargets);
let bots = $derived(telegramBotsCache.items);
let telegramBots = $derived(telegramBotsCache.items);
let emailBots = $derived(emailBotsCache.items);
let matrixBots = $derived(matrixBotsCache.items);
let botChats = $state<Record<number, TelegramChat[]>>({});
@@ -237,9 +237,9 @@
<select id="tgt-bot" bind:value={form.bot_id} onchange={loadBotChats} required
class="w-full px-3 py-2 border border-[var(--color-border)] rounded-md text-sm bg-[var(--color-background)]">
<option value={0} disabled>{t('telegramBot.selectBot')}</option>
{#each bots as bot}<option value={bot.id}>{bot.name} (@{bot.bot_username})</option>{/each}
{#each telegramBots as bot}<option value={bot.id}>{bot.name} (@{bot.bot_username})</option>{/each}
</select>
{#if bots.length === 0}
{#if telegramBots.length === 0}
<p class="text-xs text-[var(--color-muted-foreground)] mt-1">{t('telegramBot.noBots')} <a href="/telegram-bots" class="underline"></a></p>
{/if}
</div>