Use phase filters for suggestions; allow joker edge
This commit is contained in:
@@ -116,10 +116,6 @@ public static class SuggestEndpoints
|
||||
if (player is null) return Results.Unauthorized();
|
||||
var isAdmin = await EndpointHelpers.IsAdmin(ctx, db);
|
||||
|
||||
var phase = await EndpointHelpers.GetPhase(db, player.Id);
|
||||
if (!isAdmin && phase != Phase.Suggest)
|
||||
return Results.BadRequest(new { error = "Suggestions are frozen; you can no longer delete them." });
|
||||
|
||||
var suggestion = isAdmin
|
||||
? await db.Suggestions.FirstOrDefaultAsync(s => s.Id == id)
|
||||
: await db.Suggestions.FirstOrDefaultAsync(s => s.Id == id && s.PlayerId == player.Id);
|
||||
@@ -144,13 +140,7 @@ public static class SuggestEndpoints
|
||||
var player = await EndpointHelpers.GetAuthenticatedPlayer(ctx, db);
|
||||
var isAdmin = await EndpointHelpers.IsAdmin(ctx, db);
|
||||
|
||||
if (!isAdmin)
|
||||
{
|
||||
if (player is null) return Results.Unauthorized();
|
||||
|
||||
var phase = await EndpointHelpers.GetPhase(db, player.Id);
|
||||
// Non-admins can edit optional fields after Suggest, but not the name
|
||||
}
|
||||
if (!isAdmin && player is null) return Results.Unauthorized();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.Name) || request.Name.Length > 100)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user