diff --git a/src/service/rooms/timeline/data.rs b/src/service/rooms/timeline/data.rs index 42bede4f..9fe403fe 100644 --- a/src/service/rooms/timeline/data.rs +++ b/src/service/rooms/timeline/data.rs @@ -87,14 +87,21 @@ impl Data { .map(|pdu_id| pdu_id.pdu_count()) } + /// Returns the json of a pdu. + pub(super) async fn get_outlier_pdu_json( + &self, + event_id: &EventId, + ) -> Result { + self.eventid_outlierpdu + .get(event_id) + .await + .deserialized() + } + /// Returns the json of a pdu. pub(super) async fn get_pdu_json(&self, event_id: &EventId) -> Result { let accepted = self.get_non_outlier_pdu_json(event_id).boxed(); - let outlier = self - .eventid_outlierpdu - .get(event_id) - .map(Deserialized::deserialized) - .boxed(); + let outlier = self.get_outlier_pdu_json(event_id).boxed(); select_ok([accepted, outlier]).await.map(at!(0)) } @@ -133,16 +140,22 @@ impl Data { self.pduid_pdu.exists(&pduid).await } + /// Returns the pdu. + /// + /// Checks the `eventid_outlierpdu` Tree if not found in the timeline. + pub(super) async fn get_outlier_pdu(&self, event_id: &EventId) -> Result { + self.eventid_outlierpdu + .get(event_id) + .await + .deserialized() + } + /// Returns the pdu. /// /// Checks the `eventid_outlierpdu` Tree if not found in the timeline. pub(super) async fn get_pdu(&self, event_id: &EventId) -> Result { let accepted = self.get_non_outlier_pdu(event_id).boxed(); - let outlier = self - .eventid_outlierpdu - .get(event_id) - .map(Deserialized::deserialized) - .boxed(); + let outlier = self.get_outlier_pdu(event_id).boxed(); select_ok([accepted, outlier]).await.map(at!(0)) }