Fix custom account data serialization (#165)

Stylistic change

Fix custom data serialization

Build a custom event before storing global account data

Co-authored-by: Guillem Nieto <gnieto.talo@gmail.com>
Reviewed-on: https://git.koesters.xyz/timo/conduit/pulls/165
Reviewed-by: Timo Kösters <timo@koesters.xyz>
merge-requests/22/head
gnieto 4 years ago committed by Timo Kösters
parent c4260bde81
commit cc411c530b

@ -67,11 +67,12 @@ use ruma::{
unversioned::get_supported_versions, unversioned::get_supported_versions,
}, },
events::{ events::{
custom::CustomEventContent,
room::{ room::{
canonical_alias, guest_access, history_visibility, join_rules, member, name, redaction, canonical_alias, guest_access, history_visibility, join_rules, member, name, redaction,
topic, topic,
}, },
AnyEphemeralRoomEvent, AnyEvent, AnySyncEphemeralRoomEvent, EventType, AnyEphemeralRoomEvent, AnyEvent, AnySyncEphemeralRoomEvent, BasicEvent, EventType,
}, },
Raw, RoomAliasId, RoomId, RoomVersionId, UserId, Raw, RoomAliasId, RoomId, RoomVersionId, UserId,
}; };
@ -601,8 +602,13 @@ pub fn set_global_account_data_route(
db.account_data.update( db.account_data.update(
None, None,
user_id, user_id,
EventType::Custom(event_type), event_type.clone().into(),
&content, &BasicEvent {
content: CustomEventContent {
event_type,
json: content,
},
},
&db.globals, &db.globals,
)?; )?;

Loading…
Cancel
Save