refactor(event cache): remove unused impl of PaginableRoom for WeakRoom

This commit is contained in:
Benjamin Bouvier
2025-06-26 17:46:12 +02:00
parent 9d1c296657
commit 6dcc744b48

View File

@@ -25,7 +25,7 @@ use ruma::{api::Direction, EventId, OwnedEventId, UInt};
use super::pagination::PaginationToken;
use crate::{
room::{EventWithContextResponse, Messages, MessagesOptions, WeakRoom},
room::{EventWithContextResponse, Messages, MessagesOptions},
Room,
};
@@ -453,31 +453,6 @@ impl PaginableRoom for Room {
}
}
impl PaginableRoom for WeakRoom {
async fn event_with_context(
&self,
event_id: &EventId,
lazy_load_members: bool,
num_events: UInt,
) -> Result<EventWithContextResponse, PaginatorError> {
let Some(room) = self.get() else {
// Client is shutting down, return a default response.
return Ok(EventWithContextResponse::default());
};
PaginableRoom::event_with_context(&room, event_id, lazy_load_members, num_events).await
}
async fn messages(&self, opts: MessagesOptions) -> Result<Messages, PaginatorError> {
let Some(room) = self.get() else {
// Client is shutting down, return a default response.
return Ok(Messages::default());
};
PaginableRoom::messages(&room, opts).await
}
}
#[cfg(all(not(target_family = "wasm"), test))]
mod tests {
use std::sync::Arc;