Skip serializing optional values on RoomEncryption

If this parameters are not skipped, they are sent as null and some
clients (at least, Riot) coerces them to 0.
This commit is contained in:
Guillem Nieto 2020-06-25 20:33:35 +02:00 committed by Jonas Platte
parent 928fe6ce26
commit 202af7a523
2 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Breaking changes:
Improvements:
* Add `room::MessageFormat` and `room::FormattedBody`
* Skip serialization of optional values on `room::encryption::EncryptionEventContent`
Deprecations:

View File

@ -21,10 +21,12 @@ pub struct EncryptionEventContent {
/// How long the session should be used before changing it.
///
/// 604800000 (a week) is the recommended default.
#[serde(skip_serializing_if = "Option::is_none")]
pub rotation_period_ms: Option<UInt>,
/// How many messages should be sent before changing the session.
///
/// 100 is the recommended default.
#[serde(skip_serializing_if = "Option::is_none")]
pub rotation_period_msgs: Option<UInt>,
}