Add upper-bound to readreceipts_since() and callsites.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -66,6 +66,7 @@ impl Data {
|
||||
&'a self,
|
||||
room_id: &'a RoomId,
|
||||
since: u64,
|
||||
to: Option<u64>,
|
||||
) -> impl Stream<Item = ReceiptItem<'_>> + Send + 'a {
|
||||
type Key<'a> = (&'a RoomId, u64, &'a UserId);
|
||||
type KeyVal<'a> = (Key<'a>, CanonicalJsonObject);
|
||||
@@ -76,7 +77,9 @@ impl Data {
|
||||
self.readreceiptid_readreceipt
|
||||
.stream_from(&first_possible_edu)
|
||||
.ignore_err()
|
||||
.ready_take_while(move |((r, ..), _): &KeyVal<'_>| *r == room_id)
|
||||
.ready_take_while(move |((r, c, ..), _): &KeyVal<'_>| {
|
||||
*r == room_id && to.is_none_or(|to| *c <= to)
|
||||
})
|
||||
.map(move |((_, count, user_id), mut json): KeyVal<'_>| {
|
||||
json.remove("room_id");
|
||||
|
||||
|
||||
@@ -126,8 +126,9 @@ impl Service {
|
||||
&'a self,
|
||||
room_id: &'a RoomId,
|
||||
since: u64,
|
||||
to: Option<u64>,
|
||||
) -> impl Stream<Item = ReceiptItem<'_>> + Send + 'a {
|
||||
self.db.readreceipts_since(room_id, since)
|
||||
self.db.readreceipts_since(room_id, since, to)
|
||||
}
|
||||
|
||||
/// Sets a private read marker at PDU `count`.
|
||||
|
||||
Reference in New Issue
Block a user