fix: Address redacted content review nitpicks

This commit is contained in:
Erwan Leboucher authored and Ellis Git committed 2026-11-11 21:52:50 +00:00
1 parent f154ecb542
commit 8603ae21cc
3 files changed
+24 -19

No files matched your search

+1 -1
View File
@@ -93,7 +93,7 @@ struct Services {
users: Dep<users::Service>,
}
const PURGE_INTERVAL_SECS: u64 = 60 * 60;
const PURGE_INTERVAL_SECS: u64 = 3600;
type RoomMutexMap = MutexMap<OwnedRoomId, ()>;
pub type RoomMutexGuard = MutexMapGuard<OwnedRoomId, ()>;
+12 -7
View File
@@ -4,7 +4,7 @@ use conduwuit_core::{
utils::{self},
warn,
};
use ruma::{EventId, events::room::encrypted::Relation};
use ruma::{EventId, events::room::encrypted::Relation, signatures::content_hash};
use super::{ExtractBody, ExtractRelatesTo};
use crate::rooms::short::ShortRoomId;
@@ -52,13 +52,18 @@ impl super::Service {
.get_room_version(&pdu.room_id_or_hash())
.await?;
if !pdu.is_redacted()
&& self
.services
.config
.allow_moderators_to_view_redacted_content
if self
.services
.config
.allow_moderators_to_view_redacted_content
{
self.db.save_unredacted_content(&pdu_id, &pdu.content);
let mut pdu_json = self.get_pdu_json_from_id(&pdu_id).await?;
pdu_json.remove("event_id");
if content_hash(&pdu_json)
.is_ok_and(|hash| hash.encode() == pdu.hashes.sha256.trim_end_matches('='))
{
self.db.save_unredacted_content(&pdu_id, &pdu.content);
}
}
pdu.redact(&room_version_id, Some(reason.event_id()))?;