events: Fix issues from not testing previous commits

This commit is contained in:
Jonas Platte 2021-05-16 22:53:00 +02:00
parent 55df2aa26a
commit ecf875358c
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
5 changed files with 9 additions and 11 deletions

View File

@ -47,7 +47,7 @@ impl ThirdPartyInviteEventContent {
/// Creates a new `ThirdPartyInviteEventContent` with the given display name, key validity url
/// and public key.
pub fn new(display_name: String, key_validity_url: String, public_key: String) -> Self {
Self { display_name, key_validity_url, public_key, public_keys }
Self { display_name, key_validity_url, public_key, public_keys: None }
}
}

View File

@ -24,7 +24,7 @@ use serde_json::{
fn unsigned() -> RedactedUnsigned {
let mut unsigned = RedactedUnsigned::default();
unsigned.redacted_because = Some(Box::new(SyncRedactionEvent {
content: RedactionEventContent { reason: Some("redacted because".into()) },
content: RedactionEventContent::with_reason("redacted because".into()),
redacts: event_id!("$h29iv0s8:example.com"),
event_id: event_id!("$h29iv0s8:example.com"),
origin_server_ts: MilliSecondsSinceUnixEpoch(uint!(1)),
@ -167,7 +167,7 @@ fn redacted_deserialize_any_room_sync() {
// to return early with `RedactedContent` instead of failing to deserialize according
// to the event type string.
unsigned.redacted_because = Some(Box::new(SyncRedactionEvent {
content: RedactionEventContent { reason: Some("redacted because".into()) },
content: RedactionEventContent::with_reason("redacted because".into()),
redacts: event_id!("$h29iv0s8:example.com"),
event_id: event_id!("$h29iv0s8:example.com"),
origin_server_ts: MilliSecondsSinceUnixEpoch(uint!(1)),
@ -310,7 +310,7 @@ fn redact_method_properly_redacts() {
});
let redaction = SyncRedactionEvent {
content: RedactionEventContent { reason: Some("redacted because".into()) },
content: RedactionEventContent::with_reason("redacted because".into()),
redacts: event_id!("$143273582443PhrSn:example.com"),
event_id: event_id!("$h29iv0s8:example.com"),
origin_server_ts: MilliSecondsSinceUnixEpoch(uint!(1)),

View File

@ -28,7 +28,7 @@ fn redaction() -> JsonValue {
#[test]
fn serialize_redaction() {
let aliases_event = RedactionEvent {
content: RedactionEventContent { reason: Some("being a turd".into()) },
content: RedactionEventContent::with_reason("being a turd".into()),
redacts: event_id!("$nomore:example.com"),
event_id: event_id!("$h29iv0s8:example.com"),
origin_server_ts: MilliSecondsSinceUnixEpoch(uint!(1)),
@ -53,7 +53,7 @@ fn deserialize_redaction() {
.deserialize()
.unwrap(),
AnyMessageEvent::RoomRedaction(RedactionEvent {
content: RedactionEventContent { reason: Some(reas) },
content: RedactionEventContent { reason: Some(reas), .. },
redacts,
event_id,
origin_server_ts,

View File

@ -160,7 +160,7 @@ fn relates_to_content_serialization() {
let message_event_content =
assign!(MessageEventContent::text_plain("> <@test:example.com> test\n\ntest reply"), {
relates_to: Some(Relation::Reply {
in_reply_to: InReplyTo { event_id: event_id!("$15827405538098VGFWH:example.com") },
in_reply_to: InReplyTo::new(event_id!("$15827405538098VGFWH:example.com")),
}),
});

View File

@ -9,9 +9,7 @@ use serde_json::{from_value as from_json_value, json, to_value as to_json_value}
#[test]
fn serialize_stripped_state_event_any_content() {
let event = StrippedStateEvent {
content: AnyStateEventContent::RoomTopic(TopicEventContent {
topic: "Testing room".into(),
}),
content: AnyStateEventContent::RoomTopic(TopicEventContent::new("Testing room".into())),
state_key: "".into(),
sender: user_id!("@example:localhost"),
};
@ -31,7 +29,7 @@ fn serialize_stripped_state_event_any_content() {
#[test]
fn serialize_stripped_state_event_any_event() {
let event = AnyStrippedStateEvent::RoomTopic(StrippedStateEvent {
content: TopicEventContent { topic: "Testing room".into() },
content: TopicEventContent::new("Testing room".into()),
state_key: "".into(),
sender: user_id!("@example:localhost"),
});