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 muted and joined channel list queries with empty data (Auto Filtering Enabled) #2634
Fix muted and joined channel list queries with empty data (Auto Filtering Enabled) #2634
Conversation
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.
LGTM 🚀
@@ -111,13 +111,19 @@ public struct Filter<Scope: FilterScope> { | |||
/// Whether the `keyPathString` represents an array in the DTO entities. | |||
let isCollectionFilter: Bool | |||
|
|||
/// The mapper that will override the DB Predicate. This might be needed |
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.
The comment is very helpful. Thanks for adding it!
switch op { | ||
case .equal: | ||
return NSPredicate(format: muted ? "\(key) != nil" : "\(key) == nil") | ||
default: |
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.
The code looks the same in both implementations (but the keyPath). Should we be reusing it by placing it in a single place? We are probably using the same logic in other places?
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.
For now, I think it is fine to have a little duplication. We can introduce a helper to reuse this logic if we see more use cases like this. 👍
Kudos, SonarCloud Quality Gate passed! |
🔗 Issue Links
Resolves https://github.com/GetStream/ios-issues-tracking/issues/423
🎯 Goal
Fix the channel list query being empty when the
.muted
and.joined
filters were used with auto filtering enabled.🛠 Implementation
We currently have an issue with our Auto Filtering where the
.muted
and.joined
filters do not properly map to our DB predicates.After some analysis and discussion with @ipavlidakis, we opted for introducing a
PredicateMapper
so that a filter can override the default Predicate logic.🧪 Manual Testing Notes
Unit tests were added to prove it works correctly.
☑️ Contributor Checklist