From f5746ee0f68d7a98e615b02ba58ede4ae0103a42 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 27 May 2025 18:04:52 +0300 Subject: [PATCH] event: add omitempty for mod policy entity Only one of hash and entity should be set --- event/state.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event/state.go b/event/state.go index 006ed2a5..028691e1 100644 --- a/event/state.go +++ b/event/state.go @@ -231,7 +231,7 @@ func (ph *PolicyHashes) DecodeSHA256() *[32]byte { // ModPolicyContent represents the content of a m.room.rule.user, m.room.rule.room, and m.room.rule.server state event. // https://spec.matrix.org/v1.2/client-server-api/#moderation-policy-lists type ModPolicyContent struct { - Entity string `json:"entity"` + Entity string `json:"entity,omitempty"` Reason string `json:"reason"` Recommendation PolicyRecommendation `json:"recommendation"` UnstableHashes *PolicyHashes `json:"org.matrix.msc4205.hashes,omitempty"`