mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-28 05:45:48 +00:00
add latest_pdu_in_room
timeline function
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
1af65e695d
commit
ffdf47d1ea
|
@ -82,6 +82,14 @@ impl Service {
|
|||
.transpose()
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub fn latest_pdu_in_room(&self, room_id: &RoomId) -> Result<Option<Arc<PduEvent>>> {
|
||||
self.all_pdus(user_id!("@placeholder:conduwuit.placeholder"), room_id)?
|
||||
.last()
|
||||
.map(|o| o.map(|(_, p)| Arc::new(p)))
|
||||
.transpose()
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub fn last_timeline_count(&self, sender_user: &UserId, room_id: &RoomId) -> Result<PduCount> {
|
||||
self.db.last_timeline_count(sender_user, room_id)
|
||||
|
|
Loading…
Reference in a new issue