fix(audit): reason и entity_id в audit как строки, не map.
CI / test (push) Successful in 15m19s

Модерация писала #{reason => ...} — UI падал с React #31.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-16 14:08:25 +03:00
parent 6d91e9cf18
commit 77a53c77cd
3 changed files with 23 additions and 15 deletions
+2 -5
View File
@@ -135,13 +135,10 @@ test_moderate_calendar_audit(Token) ->
SuperToken = api_test_runner:get_superadmin_token(),
AuditRecords = api_test_runner:admin_get(<<"/v1/admin/audit?action=freeze_calendar">>, SuperToken),
?assert(length(AuditRecords) >= 1),
Matching = [R || R <- AuditRecords,
case maps:get(<<"entity_id">>, R) of
#{<<"id">> := Id} -> Id =:= CalId;
_ -> false
end],
Matching = [R || R <- AuditRecords, maps:get(<<"entity_id">>, R) =:= CalId],
?assert(length(Matching) >= 1),
Last = hd(Matching),
?assertEqual(<<"freeze_calendar">>, maps:get(<<"action">>, Last)),
?assertEqual(<<"calendar">>, maps:get(<<"entity_type">>, Last)),
?assertEqual(<<"Violation">>, maps:get(<<"reason">>, Last)),
ct:pal(" OK: audit record found").