feat: Add heros support for sliding sync room. (#1691)
This patch is only based on https://github.com/matrix-org/sliding-sync/ pull/304 since the specification wasn't updated. I'm basically guessing what a request and a response _should_ look like: * `RoomSubscription` gains a new field: `include_heros`, * `SlidingSyncRoom` gains a new field: `heros`, * `SlidingSyncRoomHero` is a new type.
This commit is contained in:
parent
1c4f26af74
commit
1c1cfe9a7e
@ -12,7 +12,7 @@ use ruma_common::{
|
|||||||
api::{request, response, Metadata},
|
api::{request, response, Metadata},
|
||||||
metadata,
|
metadata,
|
||||||
serde::{deserialize_cow_str, duration::opt_ms, Raw},
|
serde::{deserialize_cow_str, duration::opt_ms, Raw},
|
||||||
DeviceKeyAlgorithm, MilliSecondsSinceUnixEpoch, OwnedMxcUri, OwnedRoomId, RoomId,
|
DeviceKeyAlgorithm, MilliSecondsSinceUnixEpoch, OwnedMxcUri, OwnedRoomId, OwnedUserId, RoomId,
|
||||||
};
|
};
|
||||||
use ruma_events::{
|
use ruma_events::{
|
||||||
receipt::SyncReceiptEvent, typing::SyncTypingEvent, AnyGlobalAccountDataEvent,
|
receipt::SyncReceiptEvent, typing::SyncTypingEvent, AnyGlobalAccountDataEvent,
|
||||||
@ -362,6 +362,10 @@ pub struct RoomSubscription {
|
|||||||
/// The maximum number of timeline events to return per room. Sticky.
|
/// The maximum number of timeline events to return per room. Sticky.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub timeline_limit: Option<UInt>,
|
pub timeline_limit: Option<UInt>,
|
||||||
|
|
||||||
|
/// Include the room heroes. Sticky.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub include_heroes: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Operation applied to the specific SlidingSyncList
|
/// Operation applied to the specific SlidingSyncList
|
||||||
@ -479,6 +483,10 @@ pub struct SlidingSyncRoom {
|
|||||||
/// relying on the latest event.
|
/// relying on the latest event.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub timestamp: Option<MilliSecondsSinceUnixEpoch>,
|
pub timestamp: Option<MilliSecondsSinceUnixEpoch>,
|
||||||
|
|
||||||
|
/// Heroes of the room, if requested by a room subscription.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub heroes: Option<Vec<SlidingSyncRoomHero>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SlidingSyncRoom {
|
impl SlidingSyncRoom {
|
||||||
@ -488,6 +496,23 @@ impl SlidingSyncRoom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A sliding sync room hero.
|
||||||
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
|
pub struct SlidingSyncRoomHero {
|
||||||
|
/// The user ID of the hero.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub user_id: Option<OwnedUserId>,
|
||||||
|
|
||||||
|
/// The name of the hero.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub name: Option<String>,
|
||||||
|
|
||||||
|
/// The avatar of the hero.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub avatar: Option<OwnedMxcUri>,
|
||||||
|
}
|
||||||
|
|
||||||
/// Sliding-Sync extension configuration.
|
/// Sliding-Sync extension configuration.
|
||||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user