6cb2fbe610
PR Checks / test-and-build (pull_request) Successful in 7m28s
Implements Issue #110: game masters can now publish sessions exclusively to a club's private showcase, gated behind a member application and approval flow. Adds a 4-state publication_mode (None/Catalog/ClubOnly/Both) replacing the binary is_public, plus a club_memberships table with Pending/Active/Rejected/Left lifecycle and partial unique index ensuring a single Active row per (group, player). Highlights - V030 migration: club_memberships, publication_mode, drop is_public, recreate partial indexes, portfolio_games gains publication_mode. - PublicationMode enum + extensions in GmRelay.Shared. - ISessionStore gains 12 membership/showcase methods; AuthorizedMembershipService owns the membership flow with GM-only approve/reject authorization. - PublicClub / PublicMasterProfile / PublicSession: member- aware queries (ClubOnly visible only to Active members). - New pages: MyClubMemberships (/profile/memberships) and ClubApplications (/group/{id}/applications). - GroupDetails and EditSession switch from a bool toggle to a 4-state publication_mode selector. - NavMenu adds Moji kluby, PublicLayout adds Kluby. Tests: 4 new test files (PublicationMode, ClubMemberships, AuthorizedMembershipService, ClubShowcaseSource) + updates to PublicClubPages, AuthorizedSessionService/Portfolio service FakeSessionStore, CampaignTemplatesNavigation. 493 tests pass. Bump version 3.6.0 -> 3.7.0 across Directory.Build.props, compose.yaml, deploy.yml, NavMenu.razor. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
152 lines
5.1 KiB
Plaintext
152 lines
5.1 KiB
Plaintext
@page "/group/{GroupId:guid}/applications"
|
|
@using GmRelay.Web.Services
|
|
@using GmRelay.Shared.Domain
|
|
@using Microsoft.AspNetCore.Authorization
|
|
@attribute [Authorize]
|
|
@inject AuthorizedMembershipService MembershipService
|
|
@inject AuthorizedSessionService SessionService
|
|
@inject NavigationManager Navigation
|
|
@inject IHttpContextAccessor HttpContextAccessor
|
|
@using System.Security.Claims
|
|
|
|
<PageTitle>Заявки участников — GM-Relay</PageTitle>
|
|
|
|
<div class="page-container">
|
|
<ul class="gm-breadcrumb animate-fade-in">
|
|
<li><a href="/">Главная</a></li>
|
|
<li><a href="@($"/group/{GroupId}")">Группа</a></li>
|
|
<li class="active">Заявки</li>
|
|
</ul>
|
|
|
|
<div class="page-header animate-fade-in">
|
|
<h2>📨 Заявки участников</h2>
|
|
<p>Одобряйте или отклоняйте заявки на участие в клубе.</p>
|
|
</div>
|
|
|
|
@if (accessDenied)
|
|
{
|
|
<div class="glass-card public-empty-state">
|
|
<h2>Нет доступа</h2>
|
|
<p>Только owner или co-GM группы могут просматривать заявки.</p>
|
|
</div>
|
|
}
|
|
else if (applications is null)
|
|
{
|
|
<div class="glass-card" style="padding: 2rem;">
|
|
<div class="skeleton skeleton-text" style="width: 70%; height: 2rem; margin-bottom: 1rem;"></div>
|
|
<div class="skeleton skeleton-text" style="width: 90%;"></div>
|
|
</div>
|
|
}
|
|
else if (applications.Count == 0)
|
|
{
|
|
<div class="glass-card public-empty-state">
|
|
<h2>Новых заявок нет</h2>
|
|
<p>Когда игроки подадут заявку на участие в клубе, она появится здесь.</p>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<ul class="application-list">
|
|
@foreach (var app in applications)
|
|
{
|
|
<li class="glass-card application-item">
|
|
<div class="application-info">
|
|
<strong>@app.DisplayName</strong>
|
|
<span class="status-badge status-neutral">@app.Platform</span>
|
|
@if (!string.IsNullOrWhiteSpace(app.ExternalUsername))
|
|
{
|
|
<span class="application-meta">@app.ExternalUsername</span>
|
|
}
|
|
<span class="application-meta">@app.AppliedAt.ToString("dd.MM.yyyy HH:mm")</span>
|
|
@if (!string.IsNullOrWhiteSpace(app.Message))
|
|
{
|
|
<p class="application-message">«@app.Message»</p>
|
|
}
|
|
</div>
|
|
<div class="application-actions">
|
|
<button type="button" class="btn-gm btn-gm-success" disabled="@(busyMembershipId is not null)" @onclick="() => Approve(app.MembershipId)">
|
|
✅ Одобрить
|
|
</button>
|
|
<button type="button" class="btn-gm btn-gm-outline" disabled="@(busyMembershipId is not null)" @onclick="() => Reject(app.MembershipId)">
|
|
❌ Отклонить
|
|
</button>
|
|
</div>
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
|
|
@if (!string.IsNullOrEmpty(errorMessage))
|
|
{
|
|
<div class="gm-alert gm-alert-danger" style="margin-top: 1rem;">⚠️ @errorMessage</div>
|
|
}
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter] public Guid GroupId { get; set; }
|
|
|
|
private List<WebPendingApplication>? applications;
|
|
private bool accessDenied;
|
|
private string? errorMessage;
|
|
private Guid? busyMembershipId;
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
accessDenied = false;
|
|
try
|
|
{
|
|
applications = await MembershipService.GetPendingApplicationsAsync(GroupId);
|
|
}
|
|
catch (SessionAccessDeniedException)
|
|
{
|
|
accessDenied = true;
|
|
}
|
|
}
|
|
|
|
private async Task Approve(Guid membershipId)
|
|
{
|
|
errorMessage = null;
|
|
busyMembershipId = membershipId;
|
|
try
|
|
{
|
|
await MembershipService.ApproveForCurrentGmAsync(membershipId);
|
|
applications = await MembershipService.GetPendingApplicationsAsync(GroupId);
|
|
}
|
|
catch (SessionAccessDeniedException)
|
|
{
|
|
accessDenied = true;
|
|
}
|
|
catch (InvalidOperationException ex)
|
|
{
|
|
errorMessage = ex.Message;
|
|
}
|
|
finally
|
|
{
|
|
busyMembershipId = null;
|
|
}
|
|
}
|
|
|
|
private async Task Reject(Guid membershipId)
|
|
{
|
|
errorMessage = null;
|
|
busyMembershipId = membershipId;
|
|
try
|
|
{
|
|
await MembershipService.RejectForCurrentGmAsync(membershipId);
|
|
applications = await MembershipService.GetPendingApplicationsAsync(GroupId);
|
|
}
|
|
catch (SessionAccessDeniedException)
|
|
{
|
|
accessDenied = true;
|
|
}
|
|
catch (InvalidOperationException ex)
|
|
{
|
|
errorMessage = ex.Message;
|
|
}
|
|
finally
|
|
{
|
|
busyMembershipId = null;
|
|
}
|
|
}
|
|
}
|