base: Add docs to the newly public hoist and deserialize method

This commit is contained in:
Damir Jelić 2021-07-26 15:55:44 +02:00
parent 27ad1f42da
commit 05eeba067c

View file

@ -89,8 +89,8 @@ pub struct AdditionalUnsignedData {
pub prev_content: Option<Raw<MemberEventContent>>, pub prev_content: Option<Raw<MemberEventContent>>,
} }
/// Transform state event by hoisting `prev_content` field from `unsigned` to /// Transform an `AnySyncStateEvent` by hoisting `prev_content` field from
/// the top level. /// `unsigned` to the top level.
/// ///
/// Due to a [bug in synapse][synapse-bug], `prev_content` often ends up in /// Due to a [bug in synapse][synapse-bug], `prev_content` often ends up in
/// `unsigned` contrary to the C2S spec. Some more discussion can be found /// `unsigned` contrary to the C2S spec. Some more discussion can be found
@ -129,6 +129,16 @@ fn hoist_member_event(
Ok(e) Ok(e)
} }
/// Transform an `AnySyncRoomEvent` by hoisting `prev_content` field from
/// `unsigned` to the top level.
///
/// Due to a [bug in synapse][synapse-bug], `prev_content` often ends up in
/// `unsigned` contrary to the C2S spec. Some more discussion can be found
/// [here][discussion]. Until this is fixed in synapse or handled in Ruma, we
/// use this to hoist up `prev_content` to the top level.
///
/// [synapse-bug]: <https://github.com/matrix-org/matrix-doc/issues/684#issuecomment-641182668>
/// [discussion]: <https://github.com/matrix-org/matrix-doc/issues/684#issuecomment-641182668>
pub fn hoist_room_event_prev_content( pub fn hoist_room_event_prev_content(
event: &Raw<AnySyncRoomEvent>, event: &Raw<AnySyncRoomEvent>,
) -> StdResult<AnySyncRoomEvent, serde_json::Error> { ) -> StdResult<AnySyncRoomEvent, serde_json::Error> {