fix: ensure Telegram is always primary in identity links
When a Discord user linked Telegram via the Telegram Login Widget, LinkIdentityAsync incorrectly made Discord primary and Telegram secondary. This broke access to all Telegram groups/sessions because ResolveEffectivePlayerIdAsync returned the (empty) Discord primary. - In /auth/telegram callback, swap LinkIdentityAsync args so Telegram is always treated as the current (primary) account. - Add V022 migration to reverse any existing incorrectly-oriented player_links where Discord is primary and Telegram is secondary. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -137,9 +137,10 @@ app.MapGet("/auth/telegram", async (HttpContext context, TelegramAuthService aut
|
||||
{
|
||||
try
|
||||
{
|
||||
// Always make Telegram the primary (it has the historical data/groups)
|
||||
await sessionStore.LinkIdentityAsync(
|
||||
currentPlatform, currentExternalUserId,
|
||||
"Telegram", telegramId.ToString(System.Globalization.CultureInfo.InvariantCulture),
|
||||
currentPlatform, currentExternalUserId,
|
||||
name);
|
||||
return Results.Redirect("/profile?linked=telegram");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user