events: Move JoinRulesEventContent.allow into JoinRules

This commit is contained in:
Amanda Graven
2021-09-28 15:39:58 +02:00
committed by GitHub
parent c6144c2299
commit 3b5f3cb5a6
4 changed files with 171 additions and 37 deletions

View File

@@ -24,7 +24,7 @@ use ruma_common::MilliSecondsSinceUnixEpoch;
use ruma_events::{
pdu::{EventHash, Pdu, RoomV3Pdu},
room::{
join_rules::JoinRule,
join_rules::{JoinRule, JoinRulesEventContent},
member::{MemberEventContent, MembershipState},
},
EventType,
@@ -264,7 +264,7 @@ impl TestStore<StateEvent> {
alice(),
EventType::RoomJoinRules,
Some(""),
to_raw_json_value(&json!({ "join_rule": JoinRule::Public })).unwrap(),
to_raw_json_value(&JoinRulesEventContent::new(JoinRule::Public)).unwrap(),
&[cre.clone(), alice_mem.event_id().clone()],
&[alice_mem.event_id().clone()],
);
@@ -441,7 +441,7 @@ fn INITIAL_EVENTS() -> HashMap<EventId, Arc<StateEvent>> {
alice(),
EventType::RoomJoinRules,
Some(""),
to_raw_json_value(&json!({ "join_rule": JoinRule::Public })).unwrap(),
to_raw_json_value(&JoinRulesEventContent::new(JoinRule::Public)).unwrap(),
&["CREATE", "IMA", "IPOWER"],
&["IPOWER"],
),

View File

@@ -623,7 +623,10 @@ mod tests {
use maplit::{hashmap, hashset};
use rand::seq::SliceRandom;
use ruma_common::MilliSecondsSinceUnixEpoch;
use ruma_events::{room::join_rules::JoinRule, EventType};
use ruma_events::{
room::join_rules::{JoinRule, JoinRulesEventContent},
EventType,
};
use ruma_identifiers::{EventId, RoomVersionId};
use serde_json::{json, value::to_raw_value as to_raw_json_value};
use tracing::debug;
@@ -873,7 +876,7 @@ mod tests {
alice(),
EventType::RoomJoinRules,
Some(""),
to_raw_json_value(&json!({ "join_rule": JoinRule::Private })).unwrap(),
to_raw_json_value(&JoinRulesEventContent::new(JoinRule::Private)).unwrap(),
),
to_init_pdu_event(
"ME",

View File

@@ -12,7 +12,7 @@ use ruma_common::MilliSecondsSinceUnixEpoch;
use ruma_events::{
pdu::{EventHash, Pdu, RoomV3Pdu},
room::{
join_rules::JoinRule,
join_rules::{JoinRule, JoinRulesEventContent},
member::{MemberEventContent, MembershipState},
},
EventType,
@@ -269,7 +269,7 @@ impl TestStore<StateEvent> {
alice(),
EventType::RoomJoinRules,
Some(""),
to_raw_json_value(&json!({ "join_rule": JoinRule::Public })).unwrap(),
to_raw_json_value(&JoinRulesEventContent::new(JoinRule::Public)).unwrap(),
&[cre.clone(), alice_mem.event_id().clone()],
&[alice_mem.event_id().clone()],
);
@@ -481,7 +481,7 @@ pub fn INITIAL_EVENTS() -> HashMap<EventId, Arc<StateEvent>> {
alice(),
EventType::RoomJoinRules,
Some(""),
to_raw_json_value(&json!({ "join_rule": JoinRule::Public })).unwrap(),
to_raw_json_value(&JoinRulesEventContent::new(JoinRule::Public)).unwrap(),
&["CREATE", "IMA", "IPOWER"],
&["IPOWER"],
),