{#if loading}
{$_('common.loading')}
{:else}

{$_('comms.preferredChannel')}

{#each channels as channelId} {/each}

{$_('comms.channelConfiguration')}

{preferredChannel === 'email' ? $_('comms.primary') : $_('comms.verified')}
{#if isChannelAvailableOnServer('discord')}
{#if discordUsername} {preferredChannel === 'discord' && discordVerified ? $_('comms.primary') : discordVerified ? $_('comms.verified') : $_('comms.notVerified')} {/if}
{#if discordUsername && discordUsername === savedDiscordUsername && !discordVerified && discordBotUsername} {@const encodedHandle = session.handle.replaceAll('.', '_')}
{#if discordAppId} {$_('comms.discordOpenLink')} {/if} {$_('comms.discordStartBot', { values: { botUsername: discordBotUsername, handle: session.handle } })}
{/if}
{/if} {#if isChannelAvailableOnServer('telegram')}
{#if telegramUsername} {preferredChannel === 'telegram' && telegramVerified ? $_('comms.primary') : telegramVerified ? $_('comms.verified') : $_('comms.notVerified')} {/if}
{#if telegramUsername && telegramUsername === savedTelegramUsername && !telegramVerified && telegramBotUsername} {@const encodedHandle = session.handle.replaceAll('.', '_')}
{$_('comms.telegramOpenLink')} {$_('comms.telegramStartBot', { values: { botUsername: telegramBotUsername, handle: session.handle } })}
{/if}
{/if} {#if isChannelAvailableOnServer('signal')}
{#if signalUsername} {preferredChannel === 'signal' && signalVerified ? $_('comms.primary') : signalVerified ? $_('comms.verified') : $_('comms.notVerified')} {/if}
{#if signalUsername && signalUsername === savedSignalUsername && !signalVerified}
{/if}
{/if}

{$_('comms.messageHistory')}

{#if historyLoading}
{$_('common.loading')}
{:else if messages.length === 0}

{$_('comms.noMessages')}

{:else}
{#each messages as msg}
{msg.notificationType} {msg.channel} {msg.status}
{#if msg.subject}
{msg.subject}
{/if}
{msg.body}
{formatDate(msg.createdAt)}
{/each}
{/if}
{/if}