mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 15:21:24 +01:00
care less about room versions prior to 3
This commit is contained in:
parent
15ab91c012
commit
61d2ff7183
3 changed files with 2 additions and 17 deletions
|
|
@ -939,7 +939,6 @@ impl Service {
|
||||||
redact_id,
|
redact_id,
|
||||||
&incoming_pdu.sender,
|
&incoming_pdu.sender,
|
||||||
&incoming_pdu.room_id,
|
&incoming_pdu.room_id,
|
||||||
true,
|
|
||||||
)?
|
)?
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
@ -949,7 +948,6 @@ impl Service {
|
||||||
redact_id,
|
redact_id,
|
||||||
&incoming_pdu.sender,
|
&incoming_pdu.sender,
|
||||||
&incoming_pdu.room_id,
|
&incoming_pdu.room_id,
|
||||||
true,
|
|
||||||
)?
|
)?
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -536,17 +536,12 @@ impl Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if a given user can redact a given event
|
/// 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))]
|
#[tracing::instrument(skip(self))]
|
||||||
pub(crate) fn user_can_redact(
|
pub(crate) fn user_can_redact(
|
||||||
&self,
|
&self,
|
||||||
redacts: &EventId,
|
redacts: &EventId,
|
||||||
sender: &UserId,
|
sender: &UserId,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
federation: bool,
|
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
self.room_state_get(room_id, &StateEventType::RoomPowerLevels, "")?
|
self.room_state_get(room_id, &StateEventType::RoomPowerLevels, "")?
|
||||||
.map_or_else(
|
.map_or_else(
|
||||||
|
|
@ -583,12 +578,8 @@ impl Service {
|
||||||
.timeline
|
.timeline
|
||||||
.get_pdu(redacts)
|
.get_pdu(redacts)
|
||||||
{
|
{
|
||||||
if federation {
|
pdu.sender().server_name()
|
||||||
pdu.sender().server_name()
|
== sender.server_name()
|
||||||
== sender.server_name()
|
|
||||||
} else {
|
|
||||||
pdu.sender == sender
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -484,7 +484,6 @@ impl Service {
|
||||||
redact_id,
|
redact_id,
|
||||||
&pdu.sender,
|
&pdu.sender,
|
||||||
&pdu.room_id,
|
&pdu.room_id,
|
||||||
false,
|
|
||||||
)? {
|
)? {
|
||||||
self.redact_pdu(redact_id, pdu, shortroomid)?;
|
self.redact_pdu(redact_id, pdu, shortroomid)?;
|
||||||
}
|
}
|
||||||
|
|
@ -494,7 +493,6 @@ impl Service {
|
||||||
redact_id,
|
redact_id,
|
||||||
&pdu.sender,
|
&pdu.sender,
|
||||||
&pdu.room_id,
|
&pdu.room_id,
|
||||||
false,
|
|
||||||
)? {
|
)? {
|
||||||
self.redact_pdu(redact_id, pdu, shortroomid)?;
|
self.redact_pdu(redact_id, pdu, shortroomid)?;
|
||||||
}
|
}
|
||||||
|
|
@ -1078,7 +1076,6 @@ impl Service {
|
||||||
redact_id,
|
redact_id,
|
||||||
&pdu.sender,
|
&pdu.sender,
|
||||||
&pdu.room_id,
|
&pdu.room_id,
|
||||||
false,
|
|
||||||
)? {
|
)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::forbidden(),
|
ErrorKind::forbidden(),
|
||||||
|
|
@ -1091,7 +1088,6 @@ impl Service {
|
||||||
redact_id,
|
redact_id,
|
||||||
&pdu.sender,
|
&pdu.sender,
|
||||||
&pdu.room_id,
|
&pdu.room_id,
|
||||||
false,
|
|
||||||
)? {
|
)? {
|
||||||
return Err(Error::BadRequest(
|
return Err(Error::BadRequest(
|
||||||
ErrorKind::forbidden(),
|
ErrorKind::forbidden(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue