Skip to content

Commit

Permalink
fix: comments api accepts total votes
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed Feb 23, 2024
1 parent 78da98b commit 8944941
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/src/main/java/ani/dantotsu/connections/comments/CommentsAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object CommentsAPI {
var isBanned: Boolean = false
var isAdmin: Boolean = false
var isMod: Boolean = false
var totalVotes: Int = 0

suspend fun getCommentsForId(id: Int, page: Int = 1): CommentResponse? {
val url = "$address/comments/$id/$page"
Expand Down Expand Up @@ -110,7 +111,8 @@ object CommentsAPI {
0,
null,
Anilist.username ?: "",
Anilist.avatar
Anilist.avatar,
totalVotes = totalVotes
)
}

Expand Down Expand Up @@ -170,6 +172,7 @@ object CommentsAPI {
isBanned = parsed.user.isBanned ?: false
isAdmin = parsed.user.isAdmin ?: false
isMod = parsed.user.isMod ?: false
totalVotes = parsed.user.totalVotes
}

private fun headerBuilder(): Map<String, String> {
Expand Down Expand Up @@ -235,7 +238,9 @@ data class User(
val isAdmin: Boolean? = null,
@SerialName("is_admin")
@Serializable(with = NumericBooleanSerializer::class)
val isMod: Boolean? = null
val isMod: Boolean? = null,
@SerialName("total_votes")
val totalVotes: Int,
)

@Serializable
Expand Down Expand Up @@ -280,7 +285,9 @@ data class Comment(
@Serializable(with = NumericBooleanSerializer::class)
val isAdmin: Boolean? = null,
@SerialName("reply_count")
val replyCount: Int? = null
val replyCount: Int? = null,
@SerialName("total_votes")
val totalVotes: Int
)

@Serializable
Expand Down

0 comments on commit 8944941

Please sign in to comment.