move and deduplicate read receipt flusher.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-03-29 00:27:10 -07:00 committed by June
parent 6fa2e0814c
commit f956e8c3b5
2 changed files with 5 additions and 6 deletions

View file

@ -3,7 +3,7 @@ mod data;
pub use data::Data;
use ruma::{events::receipt::ReceiptEvent, serde::Raw, OwnedUserId, RoomId, UserId};
use crate::Result;
use crate::{services, Result};
pub struct Service {
pub db: &'static dyn Data,
@ -12,7 +12,10 @@ pub struct Service {
impl Service {
/// Replaces the previous read receipt.
pub fn readreceipt_update(&self, user_id: &UserId, room_id: &RoomId, event: ReceiptEvent) -> Result<()> {
self.db.readreceipt_update(user_id, room_id, event)
self.db.readreceipt_update(user_id, room_id, event)?;
services().sending.flush_room(room_id)?;
Ok(())
}
/// Returns an iterator over the most recent read_receipts in a room that