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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix newly joined members not having ChannelReads #1068

Merged
merged 1 commit into from May 11, 2021

Conversation

b-onc
Copy link
Contributor

@b-onc b-onc commented May 10, 2021

Cases:

  1. User A is watching the channel, non-member User B sends messageRead event
    -> We discard the event and log.debug it
  2. User A is watching the channel, new member User B sends messageRead event
    -> We create a read event for User B, this is the fix introduced in this PR
  3. User A is watching the channel, old member User B sends messageRead event
    -> Since User B is an old member, we received their read object when we queried the channel
  4. User A is watching the channel and is not a member, User B sends a message
    -> User A doesn't have a read object until they re-query the channel (backend bug) or they join, we log.info the case
  5. User A is watching the channel and is a new member, User B sends a message
    -> MemberEventMiddleware received the memberAdded event and re-queries the channel, creating a read object
    -> This is the only edge-edge case, before MemberEventMiddleware finishes creating the read object, all new messages cause the log.info log
  6. User A is watching the channel and is an old member, User B sends a message
    -> Since User A is an old member, we received their read object when we queried the channel

@b-onc b-onc added 🐞 Bug An issue or PR related to a bug 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK labels May 10, 2021
@b-onc b-onc requested a review from VojtaStavik May 10, 2021 15:26
@codecov
Copy link

codecov bot commented May 10, 2021

Codecov Report

Merging #1068 (bf1c812) into main (0254fee) will increase coverage by 0.01%.
The diff coverage is 90.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1068      +/-   ##
==========================================
+ Coverage   91.04%   91.06%   +0.01%     
==========================================
  Files         215      215              
  Lines        8974     8994      +20     
==========================================
+ Hits         8170     8190      +20     
  Misses        804      804              
Flag Coverage Δ
llc-tests 91.06% <90.47%> (+0.01%) ⬆️
llc-tests-ios12 91.06% <90.47%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Sources/StreamChat/Database/DatabaseSession.swift 97.56% <ø> (ø)
...ventMiddlewares/ChannelReadUpdaterMiddleware.swift 95.00% <86.66%> (-0.66%) ⬇️
...rces/StreamChat/Database/DTOs/ChannelReadDTO.swift 100.00% <100.00%> (ø)
Sources/StreamChat/Deprecations.swift 20.00% <0.00%> (+20.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0254fee...bf1c812. Read the comment docs.

Copy link
Contributor

@VojtaStavik VojtaStavik left a comment

Choose a reason for hiding this comment

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

Nice 👍

@VojtaStavik
Copy link
Contributor

VojtaStavik commented May 11, 2021

@b-onc can you add a changelog entry for this, please?

@b-onc b-onc force-pushed the fix-read-events-for-new-members branch from 1737703 to bf1c812 Compare May 11, 2021 13:50
@b-onc b-onc merged commit fdb859c into main May 11, 2021
@b-onc b-onc deleted the fix-read-events-for-new-members branch May 11, 2021 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants