chore: Upgrade Ruma
This commit is contained in:
committed by
Jonas Platte
parent
db11940f8f
commit
0e39a7cbf2
Generated
+7
-7
@@ -3958,7 +3958,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruma"
|
||||
version = "0.7.4"
|
||||
source = "git+https://github.com/ruma/ruma?rev=19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8#19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8"
|
||||
source = "git+https://github.com/ruma/ruma?rev=69337d1f4e4790a96c40377e895c0b1e44785e14#69337d1f4e4790a96c40377e895c0b1e44785e14"
|
||||
dependencies = [
|
||||
"assign",
|
||||
"js_int",
|
||||
@@ -3972,7 +3972,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruma-appservice-api"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/ruma/ruma?rev=19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8#19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8"
|
||||
source = "git+https://github.com/ruma/ruma?rev=69337d1f4e4790a96c40377e895c0b1e44785e14#69337d1f4e4790a96c40377e895c0b1e44785e14"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
@@ -3983,7 +3983,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruma-client-api"
|
||||
version = "0.15.3"
|
||||
source = "git+https://github.com/ruma/ruma?rev=19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8#19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8"
|
||||
source = "git+https://github.com/ruma/ruma?rev=69337d1f4e4790a96c40377e895c0b1e44785e14#69337d1f4e4790a96c40377e895c0b1e44785e14"
|
||||
dependencies = [
|
||||
"assign",
|
||||
"bytes",
|
||||
@@ -4000,7 +4000,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruma-common"
|
||||
version = "0.10.5"
|
||||
source = "git+https://github.com/ruma/ruma?rev=19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8#19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8"
|
||||
source = "git+https://github.com/ruma/ruma?rev=69337d1f4e4790a96c40377e895c0b1e44785e14#69337d1f4e4790a96c40377e895c0b1e44785e14"
|
||||
dependencies = [
|
||||
"base64 0.20.0",
|
||||
"bytes",
|
||||
@@ -4031,7 +4031,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruma-federation-api"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/ruma/ruma?rev=19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8#19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8"
|
||||
source = "git+https://github.com/ruma/ruma?rev=69337d1f4e4790a96c40377e895c0b1e44785e14#69337d1f4e4790a96c40377e895c0b1e44785e14"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"ruma-common",
|
||||
@@ -4042,7 +4042,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruma-identifiers-validation"
|
||||
version = "0.9.0"
|
||||
source = "git+https://github.com/ruma/ruma?rev=19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8#19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8"
|
||||
source = "git+https://github.com/ruma/ruma?rev=69337d1f4e4790a96c40377e895c0b1e44785e14#69337d1f4e4790a96c40377e895c0b1e44785e14"
|
||||
dependencies = [
|
||||
"js_int",
|
||||
"thiserror",
|
||||
@@ -4051,7 +4051,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "ruma-macros"
|
||||
version = "0.10.5"
|
||||
source = "git+https://github.com/ruma/ruma?rev=19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8#19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8"
|
||||
source = "git+https://github.com/ruma/ruma?rev=69337d1f4e4790a96c40377e895c0b1e44785e14#69337d1f4e4790a96c40377e895c0b1e44785e14"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro-crate",
|
||||
|
||||
+2
-2
@@ -27,8 +27,8 @@ byteorder = "1.4.3"
|
||||
ctor = "0.1.26"
|
||||
dashmap = "5.2.0"
|
||||
http = "0.2.6"
|
||||
ruma = { git = "https://github.com/ruma/ruma", rev = "19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8", features = ["client-api-c"] }
|
||||
ruma-common = { git = "https://github.com/ruma/ruma", rev = "19f68065f1d5acf3997a4f6d2ccd74549f7cd1d8" }
|
||||
ruma = { git = "https://github.com/ruma/ruma", rev = "69337d1f4e4790a96c40377e895c0b1e44785e14", features = ["client-api-c"] }
|
||||
ruma-common = { git = "https://github.com/ruma/ruma", rev = "69337d1f4e4790a96c40377e895c0b1e44785e14" }
|
||||
once_cell = "1.16.0"
|
||||
serde = "1.0.151"
|
||||
serde_html_form = "0.2.0"
|
||||
|
||||
@@ -724,7 +724,7 @@ mod tests {
|
||||
let appservice = appservice(None, None).await?;
|
||||
appservice.register_user_query(Box::new(|_, _| Box::pin(async move { true }))).await;
|
||||
|
||||
let uri = "/_matrix/app/v1/users/%40_botty_1%3Adev.famedly.local?access_token=hs_token";
|
||||
let uri = "/_matrix/app/v1/users/%40_botty_1:dev.famedly.local?access_token=hs_token";
|
||||
|
||||
let response = appservice
|
||||
.service()
|
||||
@@ -742,7 +742,7 @@ mod tests {
|
||||
let appservice = appservice(None, None).await?;
|
||||
appservice.register_room_query(Box::new(|_, _| Box::pin(async move { true }))).await;
|
||||
|
||||
let uri = "/_matrix/app/v1/rooms/%23magicforest%3Aexample.com?access_token=hs_token";
|
||||
let uri = "/_matrix/app/v1/rooms/%23magicforest:example.com?access_token=hs_token";
|
||||
|
||||
let response = appservice
|
||||
.service()
|
||||
|
||||
@@ -6,6 +6,7 @@ use std::{collections::HashSet, fmt};
|
||||
pub use members::RoomMember;
|
||||
pub use normal::{Room, RoomInfo, RoomType};
|
||||
use ruma::{
|
||||
assign,
|
||||
events::{
|
||||
room::{
|
||||
avatar::RoomAvatarEventContent, canonical_alias::RoomCanonicalAliasEventContent,
|
||||
@@ -17,7 +18,7 @@ use ruma::{
|
||||
topic::RoomTopicEventContent,
|
||||
},
|
||||
AnyStrippedStateEvent, AnySyncStateEvent, RedactContent, RedactedStateEventContent,
|
||||
StateEventContent, SyncStateEvent,
|
||||
StaticStateEventContent, SyncStateEvent,
|
||||
},
|
||||
EventId, OwnedUserId, RoomVersionId,
|
||||
};
|
||||
@@ -158,7 +159,16 @@ impl BaseRoomInfo {
|
||||
pub fn handle_stripped_state_event(&mut self, ev: &AnyStrippedStateEvent) -> bool {
|
||||
match ev {
|
||||
AnyStrippedStateEvent::RoomEncryption(encryption) => {
|
||||
self.encryption = Some(encryption.content.clone());
|
||||
if let Some(algorithm) = &encryption.content.algorithm {
|
||||
let content = assign!(RoomEncryptionEventContent::new(algorithm.clone()), {
|
||||
rotation_period_ms: encryption.content.rotation_period_ms,
|
||||
rotation_period_msgs: encryption.content.rotation_period_msgs,
|
||||
});
|
||||
self.encryption = Some(content);
|
||||
}
|
||||
// If encryption event is redacted, we don't care much. When
|
||||
// entering the room, we will fetch the proper event before
|
||||
// sending any messages.
|
||||
}
|
||||
AnyStrippedStateEvent::RoomAvatar(a) => {
|
||||
self.avatar = Some(a.into());
|
||||
@@ -232,7 +242,7 @@ trait OptionExt {
|
||||
|
||||
impl<C> OptionExt for Option<MinimalStateEvent<C>>
|
||||
where
|
||||
C: StateEventContent + RedactContent,
|
||||
C: StaticStateEventContent + RedactContent,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
{
|
||||
fn has_event_id(&self, ev_id: &EventId) -> bool {
|
||||
|
||||
@@ -55,14 +55,13 @@ use ruma::{
|
||||
},
|
||||
AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent,
|
||||
AnySyncStateEvent, EmptyStateKey, GlobalAccountDataEvent, GlobalAccountDataEventContent,
|
||||
GlobalAccountDataEventType, OriginalStateEventContent, RedactedStateEventContent,
|
||||
RoomAccountDataEvent, RoomAccountDataEventContent, RoomAccountDataEventType,
|
||||
StateEventType, StaticEventContent, SyncStateEvent,
|
||||
GlobalAccountDataEventType, RedactContent, RedactedStateEventContent, RoomAccountDataEvent,
|
||||
RoomAccountDataEventContent, RoomAccountDataEventType, StateEventType, StaticEventContent,
|
||||
StaticStateEventContent, SyncStateEvent,
|
||||
},
|
||||
serde::Raw,
|
||||
EventId, MxcUri, OwnedEventId, OwnedRoomId, OwnedUserId, RoomId, UserId,
|
||||
};
|
||||
use serde::de::DeserializeOwned;
|
||||
|
||||
/// BoxStream of owned Types
|
||||
pub type BoxStream<T> = Pin<Box<dyn futures_util::Stream<Item = T> + Send>>;
|
||||
@@ -385,8 +384,8 @@ pub trait StateStoreExt: StateStore {
|
||||
room_id: &RoomId,
|
||||
) -> Result<Option<Raw<SyncStateEvent<C>>>>
|
||||
where
|
||||
C: StaticEventContent + OriginalStateEventContent<StateKey = EmptyStateKey>,
|
||||
C::Redacted: RedactedStateEventContent + DeserializeOwned,
|
||||
C: StaticEventContent + StaticStateEventContent<StateKey = EmptyStateKey> + RedactContent,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
{
|
||||
Ok(self.get_state_event(room_id, C::TYPE.into(), "").await?.map(Raw::cast))
|
||||
}
|
||||
@@ -402,7 +401,7 @@ pub trait StateStoreExt: StateStore {
|
||||
state_key: &K,
|
||||
) -> Result<Option<Raw<SyncStateEvent<C>>>>
|
||||
where
|
||||
C: StaticEventContent + OriginalStateEventContent,
|
||||
C: StaticEventContent + StaticStateEventContent + RedactContent,
|
||||
C::StateKey: Borrow<K>,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
K: AsRef<str> + ?Sized + Sync,
|
||||
@@ -420,7 +419,7 @@ pub trait StateStoreExt: StateStore {
|
||||
room_id: &RoomId,
|
||||
) -> Result<Vec<Raw<SyncStateEvent<C>>>>
|
||||
where
|
||||
C: StaticEventContent + OriginalStateEventContent,
|
||||
C: StaticEventContent + StaticStateEventContent + RedactContent,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
{
|
||||
// FIXME: Could be more efficient, if we had streaming store accessor functions
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
use ruma::{
|
||||
assign,
|
||||
events::{
|
||||
room::member::{MembershipState, RoomMemberEventContent},
|
||||
OriginalStateEventContent, RedactContent, RedactedStateEventContent, StateEventContent,
|
||||
StrippedStateEvent, SyncStateEvent,
|
||||
room::{
|
||||
avatar::{RoomAvatarEventContent, StrippedRoomAvatarEvent},
|
||||
canonical_alias::{RoomCanonicalAliasEventContent, StrippedRoomCanonicalAliasEvent},
|
||||
create::{RoomCreateEventContent, StrippedRoomCreateEvent},
|
||||
guest_access::{
|
||||
RedactedRoomGuestAccessEventContent, RoomGuestAccessEventContent,
|
||||
StrippedRoomGuestAccessEvent,
|
||||
},
|
||||
history_visibility::{
|
||||
RoomHistoryVisibilityEventContent, StrippedRoomHistoryVisibilityEvent,
|
||||
},
|
||||
join_rules::{RoomJoinRulesEventContent, StrippedRoomJoinRulesEvent},
|
||||
member::{MembershipState, RoomMemberEventContent},
|
||||
name::{RoomNameEventContent, StrippedRoomNameEvent},
|
||||
tombstone::{
|
||||
RedactedRoomTombstoneEventContent, RoomTombstoneEventContent,
|
||||
StrippedRoomTombstoneEvent,
|
||||
},
|
||||
topic::{RedactedRoomTopicEventContent, RoomTopicEventContent, StrippedRoomTopicEvent},
|
||||
},
|
||||
RedactContent, RedactedStateEventContent, StateEventContent, StaticStateEventContent,
|
||||
SyncStateEvent,
|
||||
},
|
||||
EventId, OwnedEventId, RoomVersionId,
|
||||
};
|
||||
@@ -125,7 +145,7 @@ impl MinimalRoomMemberEvent {
|
||||
|
||||
impl<C> From<SyncStateEvent<C>> for MinimalStateEvent<C>
|
||||
where
|
||||
C: OriginalStateEventContent,
|
||||
C: StaticStateEventContent + RedactContent,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
{
|
||||
fn from(ev: SyncStateEvent<C>) -> Self {
|
||||
@@ -144,7 +164,7 @@ where
|
||||
|
||||
impl<C> From<&SyncStateEvent<C>> for MinimalStateEvent<C>
|
||||
where
|
||||
C: Clone + OriginalStateEventContent,
|
||||
C: Clone + StaticStateEventContent + RedactContent,
|
||||
C::Redacted: Clone + RedactedStateEventContent,
|
||||
{
|
||||
fn from(ev: &SyncStateEvent<C>) -> Self {
|
||||
@@ -161,12 +181,106 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<C> From<&StrippedStateEvent<C>> for MinimalStateEvent<C>
|
||||
where
|
||||
C: Clone + StateEventContent + RedactContent,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
{
|
||||
fn from(ev: &StrippedStateEvent<C>) -> Self {
|
||||
Self::Original(OriginalMinimalStateEvent { content: ev.content.clone(), event_id: None })
|
||||
impl From<&StrippedRoomAvatarEvent> for MinimalStateEvent<RoomAvatarEventContent> {
|
||||
fn from(event: &StrippedRoomAvatarEvent) -> Self {
|
||||
let content = assign!(RoomAvatarEventContent::new(), {
|
||||
info: event.content.info.clone(),
|
||||
url: event.content.url.clone(),
|
||||
});
|
||||
// event might actually be redacted, there is no way to tell for
|
||||
// stripped state events.
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&StrippedRoomNameEvent> for MinimalStateEvent<RoomNameEventContent> {
|
||||
fn from(event: &StrippedRoomNameEvent) -> Self {
|
||||
let content = RoomNameEventContent::new(event.content.name.clone());
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&StrippedRoomCreateEvent> for MinimalStateEvent<RoomCreateEventContent> {
|
||||
fn from(event: &StrippedRoomCreateEvent) -> Self {
|
||||
let content = assign!(RoomCreateEventContent::new(event.content.creator.clone()), {
|
||||
federate: event.content.federate,
|
||||
room_version: event.content.room_version.clone(),
|
||||
predecessor: event.content.predecessor.clone(),
|
||||
room_type: event.content.room_type.clone(),
|
||||
});
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&StrippedRoomHistoryVisibilityEvent>
|
||||
for MinimalStateEvent<RoomHistoryVisibilityEventContent>
|
||||
{
|
||||
fn from(event: &StrippedRoomHistoryVisibilityEvent) -> Self {
|
||||
let content =
|
||||
RoomHistoryVisibilityEventContent::new(event.content.history_visibility.clone());
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&StrippedRoomGuestAccessEvent> for MinimalStateEvent<RoomGuestAccessEventContent> {
|
||||
fn from(event: &StrippedRoomGuestAccessEvent) -> Self {
|
||||
match &event.content.guest_access {
|
||||
Some(guest_access) => {
|
||||
let content = RoomGuestAccessEventContent::new(guest_access.clone());
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
None => {
|
||||
let content = RedactedRoomGuestAccessEventContent::new();
|
||||
Self::Redacted(RedactedMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&StrippedRoomJoinRulesEvent> for MinimalStateEvent<RoomJoinRulesEventContent> {
|
||||
fn from(event: &StrippedRoomJoinRulesEvent) -> Self {
|
||||
let content = RoomJoinRulesEventContent::new(event.content.join_rule.clone());
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&StrippedRoomCanonicalAliasEvent> for MinimalStateEvent<RoomCanonicalAliasEventContent> {
|
||||
fn from(event: &StrippedRoomCanonicalAliasEvent) -> Self {
|
||||
let content = assign!(RoomCanonicalAliasEventContent::new(), {
|
||||
alias: event.content.alias.clone(),
|
||||
alt_aliases: event.content.alt_aliases.clone(),
|
||||
});
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&StrippedRoomTopicEvent> for MinimalStateEvent<RoomTopicEventContent> {
|
||||
fn from(event: &StrippedRoomTopicEvent) -> Self {
|
||||
match &event.content.topic {
|
||||
Some(topic) => {
|
||||
let content = RoomTopicEventContent::new(topic.clone());
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
None => {
|
||||
let content = RedactedRoomTopicEventContent::new();
|
||||
Self::Redacted(RedactedMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&StrippedRoomTombstoneEvent> for MinimalStateEvent<RoomTombstoneEventContent> {
|
||||
fn from(event: &StrippedRoomTombstoneEvent) -> Self {
|
||||
match (&event.content.body, &event.content.replacement_room) {
|
||||
(Some(body), Some(replacement_room)) => {
|
||||
let content =
|
||||
RoomTombstoneEventContent::new(body.clone(), replacement_room.clone());
|
||||
Self::Original(OriginalMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
_ => {
|
||||
let content = RedactedRoomTombstoneEventContent::new();
|
||||
Self::Redacted(RedactedMinimalStateEvent { content, event_id: None })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,10 @@ use ruma::{
|
||||
AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent, AnyStrippedStateEvent,
|
||||
AnySyncEphemeralRoomEvent, AnySyncMessageLikeEvent, AnySyncStateEvent,
|
||||
AnySyncTimelineEvent, AnyToDeviceEvent, EphemeralRoomEventContent,
|
||||
GlobalAccountDataEventContent, MessageLikeEventContent, OriginalStateEventContent,
|
||||
GlobalAccountDataEventContent, MessageLikeEventContent, PossiblyRedactedStateEventContent,
|
||||
RedactContent, RedactedMessageLikeEventContent, RedactedStateEventContent,
|
||||
RoomAccountDataEventContent, StateEventContent, StaticEventContent, ToDeviceEventContent,
|
||||
RoomAccountDataEventContent, StaticEventContent, StaticStateEventContent,
|
||||
ToDeviceEventContent,
|
||||
},
|
||||
serde::Raw,
|
||||
};
|
||||
@@ -99,7 +100,7 @@ impl SyncEvent for events::room::redaction::RedactedSyncRoomRedactionEvent {
|
||||
|
||||
impl<C> SyncEvent for events::SyncStateEvent<C>
|
||||
where
|
||||
C: StaticEventContent + OriginalStateEventContent,
|
||||
C: StaticEventContent + StaticStateEventContent + RedactContent,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
{
|
||||
const KIND: HandlerKind = HandlerKind::State;
|
||||
@@ -108,7 +109,7 @@ where
|
||||
|
||||
impl<C> SyncEvent for events::OriginalSyncStateEvent<C>
|
||||
where
|
||||
C: StaticEventContent + OriginalStateEventContent,
|
||||
C: StaticEventContent + StaticStateEventContent,
|
||||
{
|
||||
const KIND: HandlerKind = HandlerKind::OriginalState;
|
||||
const TYPE: Option<&'static str> = Some(C::TYPE);
|
||||
@@ -124,7 +125,7 @@ where
|
||||
|
||||
impl<C> SyncEvent for events::StrippedStateEvent<C>
|
||||
where
|
||||
C: StaticEventContent + StateEventContent,
|
||||
C: StaticEventContent + PossiblyRedactedStateEventContent,
|
||||
{
|
||||
const KIND: HandlerKind = HandlerKind::StrippedState;
|
||||
const TYPE: Option<&'static str> = Some(C::TYPE);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use ruma::{
|
||||
events::{
|
||||
BundledRelations, EventContent, EventContentFromType, MessageLikeEventContent,
|
||||
MessageLikeEventType, MessageLikeUnsigned, OriginalStateEventContent,
|
||||
OriginalSyncMessageLikeEvent, OriginalSyncStateEvent, RedactContent,
|
||||
MessageLikeEventType, MessageLikeUnsigned, OriginalSyncMessageLikeEvent,
|
||||
OriginalSyncStateEvent, PossiblyRedactedStateEventContent, RedactContent,
|
||||
RedactedMessageLikeEventContent, RedactedStateEventContent, RedactedSyncMessageLikeEvent,
|
||||
RedactedSyncStateEvent, StateEventContent, StateEventType,
|
||||
RedactedSyncStateEvent, StateEventContent, StateEventType, StaticStateEventContent,
|
||||
},
|
||||
serde::from_raw_json_value,
|
||||
EventId, MilliSecondsSinceUnixEpoch, TransactionId, UserId,
|
||||
@@ -150,11 +150,16 @@ impl RedactContent for NoStateEventContent {
|
||||
impl StateEventContent for NoStateEventContent {
|
||||
type StateKey = String;
|
||||
}
|
||||
impl OriginalStateEventContent for NoStateEventContent {
|
||||
impl StaticStateEventContent for NoStateEventContent {
|
||||
// We don't care about the `prev_content` since it wont deserialize with useful
|
||||
// data. Use this type which is `StateUnsigned` minus the `prev_content`
|
||||
// field.
|
||||
type Unsigned = MessageLikeUnsigned;
|
||||
type PossiblyRedacted = Self;
|
||||
}
|
||||
impl RedactedStateEventContent for NoStateEventContent {}
|
||||
impl RedactedStateEventContent for NoStateEventContent {
|
||||
type StateKey = String;
|
||||
}
|
||||
impl PossiblyRedactedStateEventContent for NoStateEventContent {
|
||||
type StateKey = String;
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ use ruma::{
|
||||
server_acl::RoomServerAclEventContent, MediaSource,
|
||||
},
|
||||
tag::{TagInfo, TagName},
|
||||
AnyRoomAccountDataEvent, AnyStateEvent, AnySyncStateEvent, EmptyStateKey,
|
||||
OriginalStateEventContent, RedactedStateEventContent, RoomAccountDataEvent,
|
||||
RoomAccountDataEventContent, RoomAccountDataEventType, StateEventType, StaticEventContent,
|
||||
AnyRoomAccountDataEvent, AnyStateEvent, AnySyncStateEvent, EmptyStateKey, RedactContent,
|
||||
RedactedStateEventContent, RoomAccountDataEvent, RoomAccountDataEventContent,
|
||||
RoomAccountDataEventType, StateEventType, StaticEventContent, StaticStateEventContent,
|
||||
SyncStateEvent,
|
||||
},
|
||||
serde::Raw,
|
||||
@@ -581,7 +581,7 @@ impl Common {
|
||||
/// ```
|
||||
pub async fn get_state_events_static<C>(&self) -> Result<Vec<Raw<SyncStateEvent<C>>>>
|
||||
where
|
||||
C: StaticEventContent + OriginalStateEventContent,
|
||||
C: StaticEventContent + StaticStateEventContent + RedactContent,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
{
|
||||
Ok(self.client.store().get_state_events_static(self.room_id()).await?)
|
||||
@@ -620,7 +620,7 @@ impl Common {
|
||||
/// ```
|
||||
pub async fn get_state_event_static<C>(&self) -> Result<Option<Raw<SyncStateEvent<C>>>>
|
||||
where
|
||||
C: StaticEventContent + OriginalStateEventContent<StateKey = EmptyStateKey>,
|
||||
C: StaticEventContent + StaticStateEventContent<StateKey = EmptyStateKey> + RedactContent,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
{
|
||||
self.get_state_event_static_for_key(&EmptyStateKey).await
|
||||
@@ -648,7 +648,7 @@ impl Common {
|
||||
state_key: &K,
|
||||
) -> Result<Option<Raw<SyncStateEvent<C>>>>
|
||||
where
|
||||
C: StaticEventContent + OriginalStateEventContent,
|
||||
C: StaticEventContent + StaticStateEventContent + RedactContent,
|
||||
C::StateKey: Borrow<K>,
|
||||
C::Redacted: RedactedStateEventContent,
|
||||
K: AsRef<str> + ?Sized + Sync,
|
||||
|
||||
@@ -46,8 +46,8 @@ use ruma::{
|
||||
topic::RedactedRoomTopicEventContent,
|
||||
},
|
||||
AnyMessageLikeEventContent, EmptyStateKey, FullStateEventContent, MessageLikeEventContent,
|
||||
MessageLikeEventType, OriginalStateEventContent, RedactedStateEventContent,
|
||||
StateEventContent, StateEventType,
|
||||
MessageLikeEventType, RedactedStateEventContent, StateEventContent, StateEventType,
|
||||
StaticStateEventContent,
|
||||
},
|
||||
room_id,
|
||||
serde::Raw,
|
||||
@@ -767,7 +767,7 @@ impl TestTimeline {
|
||||
content: C,
|
||||
prev_content: Option<C>,
|
||||
) where
|
||||
C: OriginalStateEventContent<StateKey = EmptyStateKey>,
|
||||
C: StaticStateEventContent<StateKey = EmptyStateKey>,
|
||||
{
|
||||
let ev = make_state_event(sender, "", content, prev_content);
|
||||
let raw = Raw::new(&ev).unwrap().cast();
|
||||
@@ -781,7 +781,7 @@ impl TestTimeline {
|
||||
content: C,
|
||||
prev_content: Option<C>,
|
||||
) where
|
||||
C: OriginalStateEventContent,
|
||||
C: StaticStateEventContent,
|
||||
{
|
||||
let ev = make_state_event(sender, state_key.as_ref(), content, prev_content);
|
||||
let raw = Raw::new(&ev).unwrap().cast();
|
||||
|
||||
@@ -369,7 +369,7 @@ async fn room_permalink() {
|
||||
|
||||
assert_eq!(
|
||||
room.matrix_to_permalink().await.unwrap().to_string(),
|
||||
"https://matrix.to/#/%21test_room%3A127.0.0.1?via=notarealhs&via=localhost"
|
||||
"https://matrix.to/#/!test_room:127.0.0.1?via=notarealhs&via=localhost"
|
||||
);
|
||||
assert_eq!(
|
||||
room.matrix_permalink(false).await.unwrap().to_string(),
|
||||
@@ -395,7 +395,7 @@ async fn room_permalink() {
|
||||
|
||||
assert_eq!(
|
||||
room.matrix_to_permalink().await.unwrap().to_string(),
|
||||
"https://matrix.to/#/%23alias%3Alocalhost"
|
||||
"https://matrix.to/#/%23alias:localhost"
|
||||
);
|
||||
assert_eq!(room.matrix_permalink(false).await.unwrap().to_string(), "matrix:r/alias:localhost");
|
||||
|
||||
@@ -418,7 +418,7 @@ async fn room_permalink() {
|
||||
|
||||
assert_eq!(
|
||||
room.matrix_to_permalink().await.unwrap().to_string(),
|
||||
"https://matrix.to/#/%23canonical%3Alocalhost"
|
||||
"https://matrix.to/#/%23canonical:localhost"
|
||||
);
|
||||
assert_eq!(
|
||||
room.matrix_permalink(false).await.unwrap().to_string(),
|
||||
@@ -459,7 +459,7 @@ async fn room_event_permalink() {
|
||||
|
||||
assert_eq!(
|
||||
room.matrix_to_event_permalink(event_id).await.unwrap().to_string(),
|
||||
"https://matrix.to/#/%21test_room%3A127.0.0.1/%2415139375512JaHAW?via=notarealhs&via=localhost"
|
||||
"https://matrix.to/#/!test_room:127.0.0.1/$15139375512JaHAW?via=notarealhs&via=localhost"
|
||||
);
|
||||
assert_eq!(
|
||||
room.matrix_event_permalink(event_id).await.unwrap().to_string(),
|
||||
@@ -485,7 +485,7 @@ async fn room_event_permalink() {
|
||||
|
||||
assert_eq!(
|
||||
room.matrix_to_event_permalink(event_id).await.unwrap().to_string(),
|
||||
"https://matrix.to/#/%21test_room%3A127.0.0.1/%2415139375512JaHAW?via=notarealhs&via=localhost"
|
||||
"https://matrix.to/#/!test_room:127.0.0.1/$15139375512JaHAW?via=notarealhs&via=localhost"
|
||||
);
|
||||
assert_eq!(
|
||||
room.matrix_event_permalink(event_id).await.unwrap().to_string(),
|
||||
|
||||
Reference in New Issue
Block a user