client-api: Don't skip all no-event timelines serializing sync response
There are some cases where a timeline can have zero events but should still be included in the api response. For example, when calling `/sync` with a filter that rejects all events after `since`, but does not necessarily reject all events in the room's history, the response should include a `prev_batch` field so that the client can search for earlier events matching the filter using `/messages`.
This commit is contained in:
parent
1689a50639
commit
3f67772dd3
@ -4,6 +4,8 @@ Bug fixes:
|
||||
|
||||
- Don't require the `failures` field in the
|
||||
`ruma_client_api::keys::upload_signatures::Response` type.
|
||||
- `sync::sync_events::v3::Timeline::is_empty` now returns `false` when the
|
||||
`limited` or `prev_batch` fields are set.
|
||||
|
||||
Breaking changes:
|
||||
|
||||
|
@ -360,8 +360,11 @@ impl Timeline {
|
||||
}
|
||||
|
||||
/// Returns true if there are no timeline updates.
|
||||
///
|
||||
/// A `Timeline` is considered non-empty if it has at least one event, a
|
||||
/// `prev_batch` value, or `limited` is `true`.
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.events.is_empty()
|
||||
!self.limited && self.prev_batch.is_none() && self.events.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user