fix: Tolerate missing status fields on veganism.social (#911)

veganism.social is doing something weird that injects statuses into the
user's timeline that are missing the fields that are normally present on
authenticated statuses.

So far I've noticed:

- `reblogged`
- `favourited`
- `bookmarked`

on the top level `Status` are missing, and if the status contains a poll
the `voted` field is also missing.

Cover up this breakage by setting defaults for these fields.
This commit is contained in:
Nik Clayton 2024-08-29 11:43:40 +02:00 committed by GitHub
parent b81b55cb56
commit 344ba62368
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ data class Poll(
val options: List<PollOption>, val options: List<PollOption>,
// Friendica can incorrectly return null for `voted`. Default to false. // Friendica can incorrectly return null for `voted`. Default to false.
// https://github.com/friendica/friendica/issues/13922 // https://github.com/friendica/friendica/issues/13922
@BooleanIfNull(false) val voted: Boolean, @BooleanIfNull(false) val voted: Boolean = false,
@Json(name = "own_votes") val ownVotes: List<Int>?, @Json(name = "own_votes") val ownVotes: List<Int>?,
) { ) {

View File

@ -43,9 +43,9 @@ data class Status(
@Json(name = "reblogs_count") val reblogsCount: Int, @Json(name = "reblogs_count") val reblogsCount: Int,
@Json(name = "favourites_count") val favouritesCount: Int, @Json(name = "favourites_count") val favouritesCount: Int,
@Json(name = "replies_count") val repliesCount: Int, @Json(name = "replies_count") val repliesCount: Int,
val reblogged: Boolean, val reblogged: Boolean = false,
val favourited: Boolean, val favourited: Boolean = false,
val bookmarked: Boolean, val bookmarked: Boolean = false,
val sensitive: Boolean, val sensitive: Boolean,
@Json(name = "spoiler_text") val spoilerText: String, @Json(name = "spoiler_text") val spoilerText: String,
val visibility: Visibility, val visibility: Visibility,