Refactor soft fail check

This commit is contained in:
Olivia Lee 2025-07-19 16:53:45 -07:00 committed by Charles Hall
parent aade2e17c2
commit 644639ad10

View file

@ -912,19 +912,22 @@ impl Service {
&incoming_pdu.content,
)?;
let soft_fail = !state_res::event_auth::auth_check(
let auth_fail_against_current = !state_res::event_auth::auth_check(
&ruma_room_version,
&incoming_pdu,
|k, s| auth_events.get(&(k.clone(), s.to_owned())),
)
.map_err(|_e| {
Error::BadRequest(ErrorKind::InvalidParam, "Auth check failed.")
})? || incoming_pdu.kind
})?;
let cannot_redact = incoming_pdu.kind
== TimelineEventType::RoomRedaction
&& services()
&& !services()
.rooms
.state_accessor
.redaction_event_allowed(&incoming_pdu)?;
let soft_fail = auth_fail_against_current || cannot_redact;
// 13. Use state resolution to find new room state