mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 07:11:24 +01:00
Refactor soft fail check
This commit is contained in:
parent
aade2e17c2
commit
644639ad10
1 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue