care less about room versions prior to 3

This commit is contained in:
Charles Hall 2025-08-10 14:53:38 -07:00
parent 15ab91c012
commit 61d2ff7183
3 changed files with 2 additions and 17 deletions

View file

@ -939,7 +939,6 @@ impl Service {
redact_id,
&incoming_pdu.sender,
&incoming_pdu.room_id,
true,
)?
} else {
false
@ -949,7 +948,6 @@ impl Service {
redact_id,
&incoming_pdu.sender,
&incoming_pdu.room_id,
true,
)?
} else {
false

View file

@ -536,17 +536,12 @@ impl Service {
}
/// Checks if a given user can redact a given event
///
/// If `federation` is `true`, it allows redaction events from any user of
/// the same server as the original event sender, [as required by room
/// versions >= v3](https://spec.matrix.org/v1.10/rooms/v11/#handling-redactions)
#[tracing::instrument(skip(self))]
pub(crate) fn user_can_redact(
&self,
redacts: &EventId,
sender: &UserId,
room_id: &RoomId,
federation: bool,
) -> Result<bool> {
self.room_state_get(room_id, &StateEventType::RoomPowerLevels, "")?
.map_or_else(
@ -583,12 +578,8 @@ impl Service {
.timeline
.get_pdu(redacts)
{
if federation {
pdu.sender().server_name()
== sender.server_name()
} else {
pdu.sender == sender
}
pdu.sender().server_name()
== sender.server_name()
} else {
false
}

View file

@ -484,7 +484,6 @@ impl Service {
redact_id,
&pdu.sender,
&pdu.room_id,
false,
)? {
self.redact_pdu(redact_id, pdu, shortroomid)?;
}
@ -494,7 +493,6 @@ impl Service {
redact_id,
&pdu.sender,
&pdu.room_id,
false,
)? {
self.redact_pdu(redact_id, pdu, shortroomid)?;
}
@ -1078,7 +1076,6 @@ impl Service {
redact_id,
&pdu.sender,
&pdu.room_id,
false,
)? {
return Err(Error::BadRequest(
ErrorKind::forbidden(),
@ -1091,7 +1088,6 @@ impl Service {
redact_id,
&pdu.sender,
&pdu.room_id,
false,
)? {
return Err(Error::BadRequest(
ErrorKind::forbidden(),