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

cid filter not working properly for filtering desired channels #4801

Closed
muaviyaijaz123 opened this issue Apr 28, 2023 · 5 comments
Closed

cid filter not working properly for filtering desired channels #4801

muaviyaijaz123 opened this issue Apr 28, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@muaviyaijaz123
Copy link

Describe the bug
I try to filtered my desired archived channels using the build in filter:

            Filters.and(
            Filters.eq("type", "messaging"),
            Filters.`in`("members", listOf(userId)),
            Filters.`in`("cid", archivedChannels) //archivedChannels is a string array consisting of cids' array
            )

The problem is it doesn't returns my desired channels when i pass a list as shown above in cid filter

BUT when i do it like this:

            Filters.and(
            Filters.eq("type", "messaging"),
            Filters.`in`("members", listOf(userId)),
            Filters.`in`("cid", listOf(archivedChannels[0],archivedChannels[1]))  //archivedChannels is a string array consisting of 
            cids' array
            )

it works fine. I'm not getting why is it because i need to pass the whole list not some static values

SDK version

  • 5.8.0

To Reproduce
Steps to reproduce the behavior:

  1. Use the filter block as mentioned above
  2. Wrong channels or no channels get shown instead of archived channels

Expected behavior
Channels passed in cid FILTER BLOCK should be visible only

Device:

  • Vendor and model: Samsung A30
  • Android version: 11
@muaviyaijaz123 muaviyaijaz123 added the bug Something isn't working label Apr 28, 2023
@muaviyaijaz123 muaviyaijaz123 changed the title cid filter not working properly for channels cid filter not working properly for filtering desired channels Apr 28, 2023
@JcMinarro
Copy link
Member

@muaviyaijaz123 The signature of our Filters class only allows a list or a vararg list of arguments.
Could you show us how you create the array (archievedChannels) to see how you use it?

@muaviyaijaz123
Copy link
Author

muaviyaijaz123 commented May 2, 2023

@JcMinarro ,
I create an archive channels list and then retrieve extra data from user like this and it gets the correct data but the list doesn't work in filter

         var archivedChannels: List<String> = ArrayList<String>()
         archivedChannels = ChatClient.instance().getCurrentUser()?.extraData?.get("archive_channels") as List<String> // list of channel cids.

@muaviyaijaz123
Copy link
Author

@JcMinarro any update on this?

@JcMinarro
Copy link
Member

@JcMinarro , I create an archive channels list and then retrieve extra data from user like this and it gets the correct data but the list doesn't work in filter

         var archivedChannels: List<String> = ArrayList<String>()
         archivedChannels = ChatClient.instance().getCurrentUser()?.extraData?.get("archive_channels") as List<String> // list of channel cids.

Sorry for the delay.
Could you verify that this casting is returning proper list of CID?

@DanielNovak
Copy link
Contributor

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants