fix: distinguish between replies to posts and comments (#427)

This commit is contained in:
Diego Beraldin 2024-01-06 22:40:38 +01:00 committed by GitHub
parent 834396bf82
commit 547fc654e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 8 deletions

View File

@ -40,10 +40,11 @@ fun InboxCardHeader(
}
InboxCardType.Reply -> {
if (mention.isOwnPost) {
append(stringResource(MR.strings.inbox_item_reply_post))
} else {
if (mention.isCommentReply) {
append(stringResource(MR.strings.inbox_item_reply_comment))
} else {
append(stringResource(MR.strings.inbox_item_reply_post))
}
}
}

View File

@ -11,7 +11,7 @@ data class PersonMentionModel(
val downvotes: Int,
val myVote: Int,
val saved: Boolean,
val isOwnPost: Boolean = false,
val isCommentReply: Boolean = false,
val publishDate: String? = null,
val read: Boolean = false,
)

View File

@ -273,12 +273,16 @@ internal fun CommentReplyView.toModel() = PersonMentionModel(
upvotes = counts.upvotes,
downvotes = counts.downvotes,
community = community.toModel(),
creator = creator.toModel(),
saved = saved,
myVote = myVote ?: 0,
),
comment = comment.toModel().copy(
score = counts.score,
upvotes = counts.upvotes,
downvotes = counts.downvotes,
community = community.toModel(),
saved = saved,
myVote = myVote ?: 0,
),
creator = creator.toModel(),
community = community.toModel(),

View File

@ -139,7 +139,9 @@ class InboxMentionsViewModel(
page = currentPage,
unreadOnly = unreadOnly,
sort = SortType.New,
)
)?.map {
it.copy(isCommentReply = it.comment.depth > 0)
}
if (!itemList.isNullOrEmpty()) {
currentPage++
}

View File

@ -146,8 +146,7 @@ class InboxRepliesViewModel(
unreadOnly = unreadOnly,
sort = SortType.New,
)?.map {
val isOwnPost = it.post.creator?.id == currentUserId
it.copy(isOwnPost = isOwnPost)
it.copy(isCommentReply = it.comment.depth > 0)
}
if (!itemList.isNullOrEmpty()) {