common: Skip serializing empty default_payload in PusherData, simplify type

This commit is contained in:
Jonas Platte 2022-02-09 18:47:24 +01:00
parent 689d911cdc
commit 932fe4fa38
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -414,7 +414,8 @@ pub struct PusherData {
/// [sygnal]: https://github.com/matrix-org/sygnal/blob/main/docs/applications.md#ios-applications-beware /// [sygnal]: https://github.com/matrix-org/sygnal/blob/main/docs/applications.md#ios-applications-beware
// Not specified, issue: https://github.com/matrix-org/matrix-doc/issues/3474 // Not specified, issue: https://github.com/matrix-org/matrix-doc/issues/3474
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
pub default_payload: Option<JsonValue>, #[serde(default, skip_serializing_if = "JsonValue::is_null")]
pub default_payload: JsonValue,
} }
impl PusherData { impl PusherData {
@ -432,7 +433,7 @@ impl PusherData {
#[cfg(feature = "unstable-pre-spec")] #[cfg(feature = "unstable-pre-spec")]
{ {
self.url.is_none() && self.format.is_none() && self.default_payload.is_none() self.url.is_none() && self.format.is_none() && self.default_payload.is_null()
} }
} }
} }