[fractal/574-empty-next-batch] API: handle empty `next_batch` fields
- From: Alexandre Franke <afranke src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/574-empty-next-batch] API: handle empty `next_batch` fields
- Date: Sat, 25 Jan 2020 11:22:35 +0000 (UTC)
commit 9abba15763a9bb5a84182081dade85aba2ca7b8d
Author: Alexandre Franke <afranke gnome org>
Date: Sat Jan 25 12:20:19 2020 +0100
API: handle empty `next_batch` fields
Fixes #574
fractal-matrix-api/src/backend/sync.rs | 2 +-
fractal-matrix-api/src/r0/sync/sync_events.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/fractal-matrix-api/src/backend/sync.rs b/fractal-matrix-api/src/backend/sync.rs
index 4c520be7..c02c8b71 100644
--- a/fractal-matrix-api/src/backend/sync.rs
+++ b/fractal-matrix-api/src/backend/sync.rs
@@ -245,7 +245,7 @@ pub fn sync(
.expect_log("Connection closed");
}
- let next_batch = response.next_batch;
+ let next_batch = response.next_batch.unwrap_or_default();
tx.send(BKResponse::Sync(Ok(next_batch)))
.expect_log("Connection closed");
}
diff --git a/fractal-matrix-api/src/r0/sync/sync_events.rs b/fractal-matrix-api/src/r0/sync/sync_events.rs
index 95bae1ac..dbbbdbfd 100644
--- a/fractal-matrix-api/src/r0/sync/sync_events.rs
+++ b/fractal-matrix-api/src/r0/sync/sync_events.rs
@@ -68,7 +68,7 @@ impl MarkPresence {
#[derive(Clone, Debug, Deserialize)]
pub struct Response {
- pub next_batch: String,
+ pub next_batch: Option<String>,
#[serde(default)]
pub rooms: Rooms,
pub presence: Option<Presence>,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]