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
[CIS-1227] [CIS-1430] Channel.membership correct handling #1736
Conversation
Sources/StreamChat/WebSocketClient/EventMiddlewares/MemberEventMiddleware.swift
Outdated
Show resolved
Hide resolved
Sources/StreamChat/WebSocketClient/EventMiddlewares/MemberEventMiddleware.swift
Outdated
Show resolved
Hide resolved
Sources/StreamChat/WebSocketClient/EventMiddlewares/MemberEventMiddleware.swift
Show resolved
Hide resolved
bb5c5db
to
a8c47ca
Compare
Sources/StreamChat/WebSocketClient/EventMiddlewares/MemberEventMiddleware.swift
Outdated
Show resolved
Hide resolved
var channel: ChatChannel? { | ||
database.viewContext.channel(cid: cid)?.asModel() | ||
} | ||
|
||
// Load the MemberListQueryDTO | ||
var memberListQueryDTO: ChannelMemberListQueryDTO? { | ||
database.viewContext.channelMemberListQuery(queryHash: memberListQuery.queryHash) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we don't use async assert here so can go with stored variable
var channel: ChatChannel? { | |
database.viewContext.channel(cid: cid)?.asModel() | |
} | |
// Load the MemberListQueryDTO | |
var memberListQueryDTO: ChannelMemberListQueryDTO? { | |
database.viewContext.channelMemberListQuery(queryHash: memberListQuery.queryHash) | |
} | |
let channel = try XCTUnwrap( | |
database.viewContext.channel(cid: cid)?.asModel() | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, are we using the channel at all? 馃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
channel
was a copy/paste leftover :D we can't use let memberListQuery
since we need it to be loaded again when we call it again
var channel: ChatChannel? { | ||
database.viewContext.channel(cid: cid)?.asModel() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't access this variable, do we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, copy/paste leftover, thank you
"extraData" : { | ||
|
||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"extraData" : { | |
}, |
"extraData" : { | ||
|
||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"extraData" : { | |
}, | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see it fixed 馃挭 Thanks!
and comments to existing fields explaining that it's equal to `membership`
so they check if `membership` is correctly updated
to duplicate the channel query filtering in delegate methods
75f9961
to
803aa0c
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1736 +/- ##
===========================================
+ Coverage 85.33% 85.36% +0.02%
===========================================
Files 234 234
Lines 11186 11224 +38
===========================================
+ Hits 9546 9581 +35
- Misses 1640 1643 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
馃敆 Issue Link
CIS-1227
CIS-1430
馃幆 Goal
CIS-1227 :
Channel.membership
was not parsed / removed in all cases. Some WS events were not handled correctly.CIS-1430 :
MemberListController
didn't reportmember.added
andnotification.added_to_channel
events correctly.馃洜 Implementation
MemberEventsMiddleware
now correctly handles all events.We cannot add members to a
MemberListQuery
if the query has a filter, since we can't verify if the member matches the filter.馃И Testing
Unit tests are implemented.
鈽戯笍 Checklist