mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-08-01 12:48:31 +00:00
fix(policy-server): Fixup refactor
This commit is contained in:
parent
dfda27fadc
commit
1726633c0f
2 changed files with 13 additions and 5 deletions
|
@ -265,7 +265,7 @@ where
|
||||||
"Event has passed policy server check or the policy server was unavailable."
|
"Event has passed policy server check or the policy server was unavailable."
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additionally, if this is a redaction for a soft-failed event, we soft-fail it
|
// Additionally, if this is a redaction for a soft-failed event, we soft-fail it
|
||||||
|
|
|
@ -166,14 +166,22 @@ pub async fn create_hash_and_sign_event(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check with the policy server
|
// Check with the policy server
|
||||||
if self
|
match self
|
||||||
.services
|
.services
|
||||||
.event_handler
|
.event_handler
|
||||||
.policyserv_check(&pdu, room_id)
|
.ask_policy_server(&pdu, room_id)
|
||||||
.await
|
.await
|
||||||
.is_err()
|
|
||||||
{
|
{
|
||||||
return Err!(Request(Forbidden(debug_warn!("Policy server marked this event as spam"))));
|
| Ok(true) => {},
|
||||||
|
| Ok(false) => {
|
||||||
|
return Err!(Request(Forbidden(debug_warn!(
|
||||||
|
"Policy server marked this event as spam"
|
||||||
|
))));
|
||||||
|
},
|
||||||
|
| Err(e) => {
|
||||||
|
// fail open
|
||||||
|
warn!("Failed to check event with policy server: {e}");
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash and sign
|
// Hash and sign
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue