From c1805e5b7ceb0b98a8e390f8daabf8364408506c Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Sun, 5 Jul 2026 13:10:40 +0200 Subject: [PATCH] feat(ui): hide current-host sign-in row in profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inside a Telegram/VK Mini App the host provider is auto-linked. Once the player also linked an email, `canUnlink` turned true and the "Unlink" control appeared on the host platform's own row — letting them unlink the very platform they are signed in through, which is meaningless. Gate the Telegram row on `!insideTelegram()` and the VK row on `!insideVK()`, reusing the runtime host detectors that already gate the "link" buttons. Symmetric: inside TG only the TG row is hidden (the VK row still shows, since VK is not the current host), and vice versa. The web and native builds are unchanged (both detectors are false there); the backend is untouched — this is a UI display gate, and `linkUnlink` still refuses to remove the last identity. Docs: FUNCTIONAL.md (+_ru mirror). --- docs/FUNCTIONAL.md | 4 +++- docs/FUNCTIONAL_ru.md | 4 +++- ui/src/screens/Profile.svelte | 18 +++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/FUNCTIONAL.md b/docs/FUNCTIONAL.md index 7bef505..196ad0a 100644 --- a/docs/FUNCTIONAL.md +++ b/docs/FUNCTIONAL.md @@ -109,7 +109,9 @@ two accounts share a game still in progress. The profile lists the account's **sign-in methods**. On the web a player can add Telegram (a login-widget popup) or VK (VK ID web login — a redirect to VK's sign-in and -back); inside a Mini App the host platform is already linked. Linking a provider that +back); inside a Mini App the host platform is already linked, and its own sign-in-method +row is hidden — the platform the player is currently signed in through cannot be unlinked +from there, only the other provider's row is shown. Linking a provider that already belongs to another account offers the same irreversible **merge** as email linking. A linked provider can be **unlinked** — except the last remaining sign-in method, which is refused so the account stays reachable. **Email is diff --git a/docs/FUNCTIONAL_ru.md b/docs/FUNCTIONAL_ru.md index 4e32af7..ff23181 100644 --- a/docs/FUNCTIONAL_ru.md +++ b/docs/FUNCTIONAL_ru.md @@ -113,7 +113,9 @@ Telegram держит **единого бота**: все игроки поль В профиле перечислены **способы входа** аккаунта. В вебе игрок может добавить Telegram (попап логин-виджета) или VK (веб-вход VK ID — редирект на страницу входа VK и -обратно); внутри Mini App платформа-хозяин уже привязана. Привязка провайдера, уже +обратно); внутри Mini App платформа-хозяин уже привязана, и её собственная плашка способа +входа скрыта — платформу, через которую игрок сейчас вошёл, отсюда отвязать нельзя, +показывается только плашка другого провайдера. Привязка провайдера, уже принадлежащего другому аккаунту, предлагает то же необратимое **слияние**, что и привязка email. Привязанного провайдера можно **отвязать** — кроме последнего оставшегося способа входа: он не отвязывается, чтобы аккаунт оставался достижимым. diff --git a/ui/src/screens/Profile.svelte b/ui/src/screens/Profile.svelte index b5f1d28..525be5f 100644 --- a/ui/src/screens/Profile.svelte +++ b/ui/src/screens/Profile.svelte @@ -13,7 +13,8 @@ import { GatewayError } from '../lib/client'; import { connection } from '../lib/connection.svelte'; import { gateway } from '../lib/gateway'; - import { loginWidgetAvailable, requestTelegramLogin } from '../lib/telegram'; + import { insideTelegram, loginWidgetAvailable, requestTelegramLogin } from '../lib/telegram'; + import { insideVK } from '../lib/vk'; import { startVKLink, vkWebLinkAvailable } from '../lib/vkid'; import { t } from '../lib/i18n/index.svelte'; import { @@ -58,6 +59,11 @@ let deletePhrase = $state(''); const telegramLinkable = loginWidgetAvailable(); const vkLinkable = vkWebLinkAvailable(); + // Inside a host Mini App the current platform's own identity must not be managed from the + // profile — unlinking the very platform you are signed in through is meaningless — so that + // provider's linked-account row is hidden here (the web / native builds still show both). + const hostTelegram = insideTelegram(); + const hostVK = insideVK(); function defaultTz(): string { const b = browserOffset(); @@ -392,8 +398,10 @@ + host provider is already linked, so its own row is hidden — the platform you are signed + in through cannot be unlinked from here (the other provider's row still shows). Email is + never unlinked — it is changed. Unlink is offered only when another identity remains + (the backend also refuses the last one). -->

{t('profile.accountsTitle')}

@@ -440,7 +448,7 @@ {/if} - {#if p.telegramLinked} + {#if p.telegramLinked && !hostTelegram}
Telegram {#if canUnlink} @@ -453,7 +461,7 @@ {/if} - {#if p.vkLinked} + {#if p.vkLinked && !hostVK}
VK {#if canUnlink} -- 2.52.0