fix(ui): schema-library delete-audit name + busy guard + edit-row guard + sanitized create-race test (#260)

This commit is contained in:
Joseph Doherty
2026-06-19 03:28:11 -04:00
parent e3b83f8561
commit 8f85cce298
5 changed files with 121 additions and 11 deletions
@@ -2323,8 +2323,13 @@ public class ManagementActor : ReceiveActor
private static async Task<object?> HandleDeleteSharedSchema(IServiceProvider sp, DeleteSharedSchemaCommand cmd, string user)
{
var repo = sp.GetRequiredService<ISharedSchemaRepository>();
// Pre-fetch the human-readable name before the row is gone so the audit
// EntityName records "Address" rather than the numeric id — mirroring the
// Site delete handler. Falls back to the id when the row is already absent.
var schema = await repo.GetByIdAsync(cmd.SharedSchemaId);
await repo.DeleteAsync(cmd.SharedSchemaId);
await AuditAsync(sp, user, "Delete", "SharedSchema", cmd.SharedSchemaId.ToString(), cmd.SharedSchemaId.ToString(), null);
await AuditAsync(sp, user, "Delete", "SharedSchema", cmd.SharedSchemaId.ToString(),
schema?.Name ?? cmd.SharedSchemaId.ToString(), null);
return true;
}