hotfix: fix Blazor circuit crash on Discord link + add missing avatar_url column
Deploy Telegram Bot / build-and-push (push) Successful in 4m53s
Deploy Telegram Bot / scan-images (push) Successful in 1m47s
Deploy Telegram Bot / deploy (push) Successful in 28s

- Replace @onclick button with plain <a href="/auth/discord"> to avoid
circuit disconnect from forceLoad navigation during event handlers.
- Add query param handling (?linked, ?link_error) in Profile.razor for
Discord callback feedback.
- Add V021 migration: ALTER TABLE players ADD COLUMN avatar_url.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 14:39:24 +03:00
parent af37f3a8ec
commit 63193310f2
2 changed files with 26 additions and 8 deletions
@@ -0,0 +1,8 @@
-- =============================================================
-- V021: Add avatar_url column to players table
-- =============================================================
-- Scope: Support storing avatar URLs for Discord and other platforms.
-- =============================================================
ALTER TABLE players
ADD COLUMN avatar_url VARCHAR(500);
+18 -8
View File
@@ -3,7 +3,6 @@
@using Microsoft.AspNetCore.Components.Authorization
@attribute [Authorize]
@inject ISessionStore SessionStore
@inject NavigationManager Navigation
<PageTitle>Профиль — GM-Relay</PageTitle>
@@ -54,9 +53,9 @@
<h2 class="section-title">Добавить аккаунт</h2>
@if (!HasLinkedPlatform("Discord"))
{
<button class="btn btn-primary" @onclick="LinkDiscord">
<a href="/auth/discord" class="btn btn-primary">
Привязать Discord
</button>
</a>
}
else
{
@@ -86,6 +85,12 @@
[CascadingParameter]
private Task<AuthenticationState>? AuthenticationStateTask { get; set; }
[SupplyParameterFromQuery]
public string? Linked { get; set; }
[SupplyParameterFromQuery(Name = "link_error")]
public string? LinkError { get; set; }
protected override async Task OnInitializedAsync()
{
if (AuthenticationStateTask is not null)
@@ -99,6 +104,16 @@
}
}
if (!string.IsNullOrWhiteSpace(Linked))
{
successMessage = $"{Linked} аккаунт успешно привязан!";
}
if (!string.IsNullOrWhiteSpace(LinkError))
{
errorMessage = $"Ошибка привязки: {Uri.UnescapeDataString(LinkError)}";
}
await LoadIdentities();
}
@@ -157,9 +172,4 @@
isUnlinking = false;
}
}
private void LinkDiscord()
{
Navigation.NavigateTo("/auth/discord", forceLoad: true);
}
}