From 1c5699e28206da116d60b7ce3e4db2acf64712e0 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Tue, 8 Oct 2024 14:44:19 +0200 Subject: [PATCH] fix: Load announcements with associated statuses correctly (#987) The `Status` type associated with an announcement is entirely different to the regular `Status` type, with a different JSON shape. The incorrect type meant a deserialisation error when loading announcements with associated statuses. --- .../kotlin/app/pachli/core/network/model/Announcement.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/network/src/main/kotlin/app/pachli/core/network/model/Announcement.kt b/core/network/src/main/kotlin/app/pachli/core/network/model/Announcement.kt index c521f4cfc..210b2e158 100644 --- a/core/network/src/main/kotlin/app/pachli/core/network/model/Announcement.kt +++ b/core/network/src/main/kotlin/app/pachli/core/network/model/Announcement.kt @@ -31,7 +31,7 @@ data class Announcement( @Json(name = "updated_at") val updatedAt: Date, val read: Boolean, val mentions: List, - val statuses: List, + val statuses: List, val tags: List, val emojis: List, val reactions: List, @@ -57,4 +57,10 @@ data class Announcement( val url: String?, @Json(name = "static_url") val staticUrl: String?, ) + + @JsonClass(generateAdapter = true) + data class AnnouncementStatus( + val id: String, + val url: String, + ) }