mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-11 08:03:09 -06:00
Fix redact logic when event domains are empty strings
This commit is contained in:
parent
df85d9df48
commit
eff4bb9e35
|
|
@ -931,6 +931,7 @@ func extractRoomVersionFromCreateEvent(event gomatrixserverlib.PDU) (
|
||||||
return roomVersion, err
|
return roomVersion, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:gocyclo
|
||||||
// MaybeRedactEvent manages the redacted status of events. There's two cases to consider in order to comply with the spec:
|
// MaybeRedactEvent manages the redacted status of events. There's two cases to consider in order to comply with the spec:
|
||||||
// "servers should not apply or send redactions to clients until both the redaction event and original event have been seen, and are valid."
|
// "servers should not apply or send redactions to clients until both the redaction event and original event have been seen, and are valid."
|
||||||
// https://matrix.org/docs/spec/rooms/v3#authorization-rules-for-events
|
// https://matrix.org/docs/spec/rooms/v3#authorization-rules-for-events
|
||||||
|
|
@ -1009,7 +1010,7 @@ func (d *EventDatabase) MaybeRedactEvent(
|
||||||
switch {
|
switch {
|
||||||
case powerlevels.UserLevel(redactionEvent.SenderID()) >= powerlevels.Redact:
|
case powerlevels.UserLevel(redactionEvent.SenderID()) >= powerlevels.Redact:
|
||||||
// 1. The power level of the redaction event’s sender is greater than or equal to the redact level.
|
// 1. The power level of the redaction event’s sender is greater than or equal to the redact level.
|
||||||
case sender1Domain == sender2Domain:
|
case sender1Domain != "" && sender2Domain != "" && sender1Domain == sender2Domain:
|
||||||
// 2. The domain of the redaction event’s sender matches that of the original event’s sender.
|
// 2. The domain of the redaction event’s sender matches that of the original event’s sender.
|
||||||
default:
|
default:
|
||||||
ignoreRedaction = true
|
ignoreRedaction = true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue