Skip to content
Snippets Groups Projects
Verified Commit 4ba3a40e authored by Mikolai Gütschow's avatar Mikolai Gütschow Committed by Sebastian
Browse files

decrease unread counter when posts are read

parent 567bb3d5
No related branches found
No related tags found
1 merge request!261Decrease unread counter when posts are read
Pipeline #12792 passed
......@@ -55,4 +55,7 @@ data class ForumItem(
unread = if (header.isRead) unread else unread + 1,
timestamp = max(header.timestamp, this.timestamp)
)
fun updateOnPostsRead(num: Int) =
copy(unread = unread - num)
}
......@@ -105,6 +105,10 @@ class ForumViewModel @Inject constructor(
e is ForumPostReceivedEvent -> {
updateItem(e.groupId) { it.updateOnPostReceived(e.header) }
}
e is ForumPostReadEvent -> {
updateItem(e.groupId) { it.updateOnPostsRead(e.numMarkedRead) }
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment