client-api: Use JsOption
for avatar
field in sliding sync response
The `avatar` field has different semantics whether it's `undefined` (hasn't changed since previous time) vs `null` (it's now unset). Let's reflect this in the API of the `SlidingSyncRoom` response. While a public breaking API change, sliding sync is still considered experimental, so we're not bumping the main version here.
This commit is contained in:
parent
1328e52387
commit
268f206dff
@ -7,6 +7,7 @@
|
|||||||
use std::{collections::BTreeMap, time::Duration};
|
use std::{collections::BTreeMap, time::Duration};
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
|
use js_option::JsOption;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::{request, response, Metadata},
|
api::{request, response, Metadata},
|
||||||
metadata,
|
metadata,
|
||||||
@ -421,8 +422,8 @@ pub struct SlidingSyncRoom {
|
|||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
|
||||||
/// The avatar of the room.
|
/// The avatar of the room.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "JsOption::is_undefined")]
|
||||||
pub avatar: Option<OwnedMxcUri>,
|
pub avatar: JsOption<OwnedMxcUri>,
|
||||||
|
|
||||||
/// Was this an initial response.
|
/// Was this an initial response.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user