From fe3a8ff66975377cae524d9d3b6025da8b59f519 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 6 Apr 2023 13:29:38 +0200 Subject: [PATCH] feat(client-api): Support `bump_event_types` in `sync::sync_events::v4::Request`. This patch updates `sync::sync_events::v4::Request` to add the new `bump_event_types` field, as described in [MSC3575] (more precisely in this [diff]). That's the first step to address https://github.com/matrix-org/matrix-rust-sdk/issues/1728. [MSC3575]: https://github.com/matrix-org/matrix-spec-proposals/blob/kegan/sync-v3/proposals/3575-sync.md [diff]: https://github.com/matrix-org/matrix-spec-proposals/compare/35b79f6ebe80f9a36c0ccd1ddc47ab0ef3f4d78f...5bd13e66df73cfcf4a635094758ed86906b84a73#diff-1f7276cbbee4eeaaca06b07d2fe58312eab735259f2490e28e04710dde77fdccL78 --- crates/ruma-client-api/src/sync/sync_events/v4.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/ruma-client-api/src/sync/sync_events/v4.rs b/crates/ruma-client-api/src/sync/sync_events/v4.rs index 33e5ba29..d6e3b666 100644 --- a/crates/ruma-client-api/src/sync/sync_events/v4.rs +++ b/crates/ruma-client-api/src/sync/sync_events/v4.rs @@ -13,7 +13,7 @@ use ruma_common::{ events::{ receipt::SyncReceiptEvent, typing::SyncTypingEvent, AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent, AnySyncStateEvent, AnySyncTimelineEvent, - AnyToDeviceEvent, StateEventType, + AnyToDeviceEvent, StateEventType, TimelineEventType, }, metadata, serde::{duration::opt_ms, Raw}, @@ -76,6 +76,16 @@ pub struct Request { #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub lists: BTreeMap, + /// An allow-list of event types which should be considered recent activity when sorting + /// `by_recency`. By omitting event types from this field, clients can ensure that + /// uninteresting events (e.g. a profil rename) do not cause a room to jump to the top of its + /// list(s). Empty or omitted `bump_event_types` have no effect; all events in a room will be + /// considered recent activity. + /// + /// This is currently per-connection, not per-list. Sticky. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub bump_event_types: Vec, + /// Specific rooms and event types that we want to receive events from. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub room_subscriptions: BTreeMap,