Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i231] Old messages are read by newly added member #5212

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

kanat
Copy link
Collaborator

@kanat kanat commented Mar 20, 2024

馃幆 Goal

Closes:

鈽戯笍Contributor Checklist

General

  • I have signed the Stream CLA (required)
  • Assigned a person / code owner group (required)
  • Thread with the PR link started in a respective Slack channel (#android-chat-core or #android-chat-ui) (required)
  • PR targets the develop branch
  • PR is linked to the GitHub issue it resolves

Code & documentation

  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (KDocs, docusaurus, tutorial)

鈽戯笍Reviewer Checklist

  • UI Components sample runs & works
  • Compose sample runs & works
  • UI Changes correct (before & after images)
  • Bugs validated (bugfixes)
  • New feature tested and works
  • Release notes and docs clearly describe changes
  • All code we touched has new or updated KDocs

馃帀 GIF

Please provide a suitable gif that describes your work on this pull request

Comment on lines +881 to +886
if (member?.createdAt?.after(lastRead) == true) {
// If the member was added after the last read, we consider it as a freshly added member.
return true
}
// If the difference between the member's creation and the last read is less than the threshold, we consider it
// as a freshly added member.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix N1

@@ -758,9 +758,11 @@ public class MessageListController(
val groupedMessages = mutableListOf<MessageListItemState>()
val membersMap = members.associateBy { it.user.id }
val sortedReads = reads
.filter { it.user.id != currentUser?.id && !it.belongsToFreshlyAddedMember(membersMap) }
.filter {
it.user.id != currentUser?.id && membersMap.contains(it.user.id)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix N2

Comment on lines 811 to 818
sortedReads.filter {
it.lastRead.after(messageCreatedAt)
&& membersMap[it.user.id]?.createdAt?.before(messageCreatedAt) == true
}
} ?: emptyList()

val isMessageRead = messageReadBy.isNotEmpty()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix N3

@kanat kanat marked this pull request as ready for review March 22, 2024 22:39
@kanat kanat requested a review from a team as a code owner March 22, 2024 22:39
@kanat kanat marked this pull request as draft March 22, 2024 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant