further simplify get_missing_events; various log calls

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-04-03 22:06:51 +00:00
parent 94b107b42b
commit b7109131e2
3 changed files with 29 additions and 40 deletions

View file

@ -1,4 +1,4 @@
use conduwuit::{debug_info, implement, utils::stream::ReadyExt};
use conduwuit::{implement, utils::stream::ReadyExt};
use futures::StreamExt;
use ruma::{
EventId, RoomId, ServerName,
@ -36,7 +36,6 @@ pub async fn server_can_see_event(
.ready_filter(|member| member.server_name() == origin);
match history_visibility {
| HistoryVisibility::WorldReadable | HistoryVisibility::Shared => true,
| HistoryVisibility::Invited => {
// Allow if any member on requesting server was AT LEAST invited, else deny
current_server_members
@ -49,9 +48,6 @@ pub async fn server_can_see_event(
.any(|member| self.user_was_joined(shortstatehash, member))
.await
},
| _ => {
debug_info!(%room_id, "Unknown history visibility, defaulting to shared: {history_visibility:?}");
true
},
| HistoryVisibility::WorldReadable | HistoryVisibility::Shared | _ => true,
}
}

View file

@ -1,4 +1,4 @@
use conduwuit::{Err, Error, Result, debug_info, implement, pdu::PduBuilder};
use conduwuit::{Err, Result, implement, pdu::PduBuilder};
use ruma::{
EventId, RoomId, UserId,
events::{
@ -76,8 +76,8 @@ pub async fn user_can_redact(
|| redacting_event
.as_ref()
.is_ok_and(|redacting_event| redacting_event.sender == sender)),
| _ => Err(Error::bad_database(
"No m.room.power_levels or m.room.create events in database for room",
| _ => Err!(Database(
"No m.room.power_levels or m.room.create events in database for room"
)),
}
},
@ -108,8 +108,6 @@ pub async fn user_can_see_event(
});
match history_visibility {
| HistoryVisibility::WorldReadable => true,
| HistoryVisibility::Shared => currently_member,
| HistoryVisibility::Invited => {
// Allow if any member on requesting server was AT LEAST invited, else deny
self.user_was_invited(shortstatehash, user_id).await
@ -118,10 +116,8 @@ pub async fn user_can_see_event(
// Allow if any member on requested server was joined, else deny
self.user_was_joined(shortstatehash, user_id).await
},
| _ => {
debug_info!(%room_id, "Unknown history visibility, defaulting to shared: {history_visibility:?}");
currently_member
},
| HistoryVisibility::WorldReadable => true,
| HistoryVisibility::Shared | _ => currently_member,
}
}