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>
next
gnieto 2020-07-29 07:48:34 +02:00 committed by Timo Kösters
parent c4260bde81
commit cc411c530b
1 changed files with 9 additions and 3 deletions

View File

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