Account merge ledger: fix the first Soul pass (suspension carried into a memberless survivor, merged status terminal, standing at the desk door, linked accounts and write time, journalled grace intake, survivor weight on moved votes, one-hop alias, State token and database guards for overlapping merges, live-Postgres tests)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Heimdall 2026-11-14 03:37:48 +00:00
commit f402eb13cc
23 changed files with 1273 additions and 97 deletions

View file

@ -37,6 +37,8 @@ public sealed class IndexModel(
internal const string ApproveSuspendedNotice = "Nothing changed: a suspended account can only be lifted with Unsuspend.";
/// <summary>Admin-only text for a Suspended row whose reason predates the SuspensionReason column; the old text is never read back from the audit trail.</summary>
internal const string LegacySuspensionText = "Suspended before reasons were recorded";
internal const string ApproveMergedNotice = "Nothing changed: that account was merged into another and cannot be approved.";
internal const string NoMembershipNotice = "Nothing changed: that account has no membership yet.";
internal const string OwnAdminRoleNotice = "Nothing changed: you cannot remove or change your own platform admin role.";
internal const string RoleOnSuspendedNotice = "Nothing changed: a suspended account's roles cannot be changed until it is unsuspended.";
@ -136,6 +138,12 @@ public sealed class IndexModel(
return RedirectToPage();
}
if (user.Membership.IsMerged)
{
Notice = ApproveMergedNotice; // only the merge ledger leaves Merged
return RedirectToPage();
}
user.Membership.Status = MembershipStatus.Active;
user.Membership.ApprovedAtUtc = timeProvider.GetUtcNow();
ApplicationBootstrapper.EnsureRole(