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

[Bug]: ChannelListQuery wont work as expected #3543

Closed
ikaru19 opened this issue Dec 27, 2024 · 4 comments
Closed

[Bug]: ChannelListQuery wont work as expected #3543

ikaru19 opened this issue Dec 27, 2024 · 4 comments
Labels
🐞 Bug An issue or PR related to a bug 🔎 Investigating This issue is currently being investigated (Not reproducible yet)

Comments

@ikaru19
Copy link

ikaru19 commented Dec 27, 2024

Actual behaviour

let queryMessage = ChannelListQuery(
            filter: .or([
                    .and([
                        .containMembers(userIds: [data.id]),
                        .nonEmpty, // Filter channels where the last message is non-empty
                        .equal("messagingType", to: "direct") // Filter channels where the messagingType is "direct"
                    ]),
                    .and([
                        .containMembers(userIds: [data.id]), // Filter channels where the user is a member
                        .in("messagingType", values: ["group","school"])
                    ])
                ]),
            sort: [
                .init(key: .custom(keyPath: \.channelType, key: "type"), isAscending: false),
                .init(key: .lastMessageAt),
                .init(key: .updatedAt)
            ]
        )
        
  let messageController = ChatClient.shared.channelListController(
            query: queryMessage,
            filter: {channel in
                if channel.isDirectMessageChannel && channel.lastMessageAt == nil {
                    return false
                } else if channel.extraData["messagingType"]?.stringValue == "activity" {
                    return false
                } else {
                    return true
                }
            }
        )

I want to achieve the sort list going to be
The channel type team must stay at the top and the messaging is on the bottom of that channel type.
for example
Chat A (channel type: Team)
Chat B (channel type: Messaging)
Chat C (channel type: Messaging)

if there is new chat on C the list going to be
Chat A (channel type: Team)
Chat C (channel type: Messaging)
Chat B (channel type: Messaging)

the current behaviour, is sometimes the chat is
Chat A (channel type: Team)
Chat B (channel type: Messaging)
Chat C (channel type: Messaging)

Expected behaviour

I want to achieve the sort list going to be
The channel type team must stay at the top and the messaging is on the bottom of that channel type.
for example
Chat A (channel type: Team)
Chat B (channel type: Messaging)
Chat C (channel type: Messaging)

if there is new chat on C the list going to be
Chat A (channel type: Team)
Chat C (channel type: Messaging)
Chat B (channel type: Messaging)

Steps to reproduce

1. Make ChatChannelListVC with controller on actual behaviour
2. Add channel with extra data ["messagingType"] ~ i'm using school, group, direct and activities
3. send a new chat and see the extra data list

Which packages are you using?

No response

Which SDK version are you using?

4.62.0

Which iOS version is the issue reproducible?

18.1

Which iPhone Device is the issue reproducible?

iPhone 16

Which Xcode version are you using?

16.1

@ikaru19 ikaru19 added the 🐞 Bug An issue or PR related to a bug label Dec 27, 2024
@nuno-vieira
Copy link
Member

Hi @ikaru19,

We will investigate this one as soon as we can, and we will let you know once we have more details 👍

Best,
Nuno

@nuno-vieira nuno-vieira added the 🔎 Investigating This issue is currently being investigated (Not reproducible yet) label Jan 3, 2025
@linear linear bot added Chat labels Jan 8, 2025
@nuno-vieira
Copy link
Member

Hi @ikaru19,

Does the response from HTTP have the correct ordering? If you use a Proxy, like Proxyman, or enable our HTTP Logger, do you see the correct order in the payload response?

Best,
Nuno

@ikaru19
Copy link
Author

ikaru19 commented Jan 9, 2025

Hi @nuno-vieira , I tried upgrading to 4.69.0. But right now it's working, i don't know what make the issue. If you want see the the HTTP Logger, I'll sent it later.

@nuno-vieira
Copy link
Member

Hi @nuno-vieira , I tried upgrading to 4.69.0. But right now it's working, i don't know what make the issue. If you want see the the HTTP Logger, I'll sent it later.

Ok nice, I'll close the issue then. No need to send the log.

Best,
Nuno

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 🔎 Investigating This issue is currently being investigated (Not reproducible yet)
Projects
None yet
Development

No branches or pull requests

2 participants