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

[CIS-1227] [CIS-1430] Channel.membership correct handling #1736

Merged
merged 7 commits into from Jan 5, 2022

Conversation

b-onc
Copy link
Contributor

@b-onc b-onc commented Dec 28, 2021

馃敆 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 report member.added and notification.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

  • I have signed the Stream CLA (required)
  • This change follows zero 鈿狅笍 policy (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Affected documentation updated (docusaurus, tutorial, CMS (task created)

@b-onc b-onc requested a review from a team as a code owner December 28, 2021 13:04
@b-onc b-onc changed the title [CIS-1227] [] [CIS-1227] [CIS-1430] Channel.membership correct handling Dec 28, 2021
@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 Dec 28, 2021
@b-onc b-onc force-pushed the cis-1227-channel-membership branch from bb5c5db to a8c47ca Compare January 4, 2022 13:19
Comment on lines 135 to 137
var channel: ChatChannel? {
database.viewContext.channel(cid: cid)?.asModel()
}

// Load the MemberListQueryDTO
var memberListQueryDTO: ChannelMemberListQueryDTO? {
database.viewContext.channelMemberListQuery(queryHash: memberListQuery.queryHash)
}
Copy link
Contributor

@evsaev evsaev Jan 5, 2022

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

Suggested change
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()
)

Copy link
Contributor

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? 馃

Copy link
Contributor Author

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

Comment on lines 552 to 554
var channel: ChatChannel? {
database.viewContext.channel(cid: cid)?.asModel()
}
Copy link
Contributor

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?

Copy link
Contributor Author

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

Comment on lines 13 to 15
"extraData" : {

},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"extraData" : {
},

Comment on lines 13 to 15
"extraData" : {

},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"extraData" : {
},

Copy link
Contributor

@evsaev evsaev left a 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!

Bahadir Oncel added 7 commits January 5, 2022 16:10
@b-onc b-onc force-pushed the cis-1227-channel-membership branch from 75f9961 to 803aa0c Compare January 5, 2022 15:10
@codecov
Copy link

codecov bot commented Jan 5, 2022

Codecov Report

Merging #1736 (803aa0c) into develop (c18de95) will increase coverage by 0.02%.
The diff coverage is 88.37%.

Impacted file tree graph

@@             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     
Flag Coverage 螖
llc-tests 85.36% <88.37%> (+0.02%) 猬嗭笍

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

Impacted Files Coverage 螖
Sources/StreamChat/Database/DTOs/ChannelDTO.swift 94.23% <酶> (酶)
...lient/EventMiddlewares/MemberEventMiddleware.swift 80.82% <86.48%> (+8.32%) 猬嗭笍
...at/WebSocketClient/Events/NotificationEvents.swift 98.79% <100.00%> (+0.03%) 猬嗭笍

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 c18de95...803aa0c. Read the comment docs.

@b-onc b-onc merged commit 752ac4e into develop Jan 5, 2022
@b-onc b-onc deleted the cis-1227-channel-membership branch January 5, 2022 15:38
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