mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-27 18:28:31 +00:00
fix(policy-server): Return the correct result when an event is marked as spam
This commit is contained in:
parent
fe06d78c8e
commit
f32f60d056
2 changed files with 8 additions and 3 deletions
|
@ -21,7 +21,8 @@ use ruma::{
|
||||||
///
|
///
|
||||||
/// If the policy server marks the event as spam, Ok(false) is returned,
|
/// If the policy server marks the event as spam, Ok(false) is returned,
|
||||||
/// otherwise Ok(true) allows the event. If the policy server cannot be
|
/// otherwise Ok(true) allows the event. If the policy server cannot be
|
||||||
/// contacted for whatever reason, Err(e) is returned.
|
/// contacted for whatever reason, Err(e) is returned, which generally is a
|
||||||
|
/// fail-open operation.
|
||||||
#[implement(super::Service)]
|
#[implement(super::Service)]
|
||||||
#[tracing::instrument(skip_all, level = "debug")]
|
#[tracing::instrument(skip_all, level = "debug")]
|
||||||
pub async fn ask_policy_server(&self, pdu: &PduEvent, room_id: &RoomId) -> Result<bool> {
|
pub async fn ask_policy_server(&self, pdu: &PduEvent, room_id: &RoomId) -> Result<bool> {
|
||||||
|
@ -113,7 +114,7 @@ pub async fn ask_policy_server(&self, pdu: &PduEvent, room_id: &RoomId) -> Resul
|
||||||
room_id = %room_id,
|
room_id = %room_id,
|
||||||
"Event was marked as spam by policy server",
|
"Event was marked as spam by policy server",
|
||||||
);
|
);
|
||||||
return Err!(Request(Forbidden("Event was marked as spam by policy server")));
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
|
|
@ -269,7 +269,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
// also
|
// also.
|
||||||
|
|
||||||
|
// TODO: this is supposed to hide redactions from policy servers, however, for
|
||||||
|
// full efficacy it also needs to hide redactions for unknown events. This
|
||||||
|
// needs to be investigated at a later time.
|
||||||
if let Some(redact_id) = incoming_pdu.redacts_id(&room_version_id) {
|
if let Some(redact_id) = incoming_pdu.redacts_id(&room_version_id) {
|
||||||
debug!(
|
debug!(
|
||||||
redact_id = %redact_id,
|
redact_id = %redact_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue