mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 08:11:24 +01:00
use event content in account_data service api instead of full events
This eliminates the possibility of passing an event that has a mismatching type, reducing the space of possible invalid states.
This commit is contained in:
parent
66210bc32d
commit
b82458a460
15 changed files with 277 additions and 240 deletions
|
|
@ -18,8 +18,7 @@ use ruma::{
|
|||
api::federation::discovery::ServerSigningKeys,
|
||||
events::{
|
||||
push_rules::PushRulesEventContent,
|
||||
room::message::RoomMessageEventContent, AnyGlobalAccountDataEvent,
|
||||
GlobalAccountDataEvent, GlobalAccountDataEventType,
|
||||
room::message::RoomMessageEventContent, GlobalAccountDataEventType,
|
||||
},
|
||||
push::Ruleset,
|
||||
serde::{Base64, Raw},
|
||||
|
|
@ -495,13 +494,13 @@ impl Service {
|
|||
services().account_data.update_global(
|
||||
admin_bot,
|
||||
&GlobalAccountDataEventType::PushRules,
|
||||
&Raw::new(&GlobalAccountDataEvent {
|
||||
content: PushRulesEventContent {
|
||||
&Raw::new(
|
||||
&PushRulesEventContent {
|
||||
global: ruleset,
|
||||
},
|
||||
})
|
||||
.expect("json serialization should always succeed")
|
||||
.cast::<AnyGlobalAccountDataEvent>(),
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
.expect("json serialization should always succeed"),
|
||||
)?;
|
||||
|
||||
res
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue