You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will see all users that have the letter in their names
Expected behavior
Only see channels the user is already a part of. In other words, only existing conversations that the user have.
Screenshots
I don't have a conversation with Ali. I shouldn't be able to see him when I type his name in the channels filter.
Additional context
In my app, a user has connections. So when he tries to send a message, he can only send a message to his connection. I have implemented this successfully like this:
`
useEffect(() => {
const fetchUsers = async () => {
if (!connectedUserData) {
setFetchError("Connected user data is not available");
return;
}
I tried the same thing with filtering channels but it didn't work. <ChannelList filters={{ type: "messaging", members:{ $and: [ { members: { $in: connectedUserData.connections.map(user => user)} }, // Existing condition:connectedUserData._idis inmembers{ id: { $ne: connectedUserData._id } }, // New condition:idis not equal toconnectedUserData._id], }, }} showChannelSearch options={{ state: true, presence: true, limit: 8 }} sort={{ last_message_at: -1 }} additionalChannelSearchProps={{ searchForChannels: true, searchQueryParams: { channelFilters: { filters: { $and: [ { members: { $in: connectedUserData.connections.map(user => user)} }, // Existing condition:connectedUserData._idis inmembers{ id: { $ne: connectedUserData._id } }, // New condition:idis not equal toconnectedUserData._id ], }, }, }, }} Preview={ChannelPreviewCustom} />
So I also I tried a simpler filter like the initial example I provided where I only filter by the connected user id but it did not work.
(While writing this, I realized it's redudant to filter channels by both connected user id and his connection requests. Since the user channels can be filtered by either of them. So one is enough.)
Package version
stream-chat-react: ^11.23.0
stream-chat ^8.37.0:
The text was updated successfully, but these errors were encountered:
Describe the bug
Filtering channels does not work. The user is able to send a message to all users by typing their names in the channels filter.
To Reproduce
<ChannelList filters={{ type: "messaging", members: { $in: [connectedUserData._id] }, }} showChannelSearch options={{ state: true, presence: true, limit: 8 }} sort={{ last_message_at: -1 }} additionalChannelSearchProps={{ searchForChannels: true, searchQueryParams: { channelFilters: { filters: { members: { $in: [connectedUserData._id] } }, }, }, }} Preview={ChannelPreviewCustom} />
Steps to reproduce the behavior:
Expected behavior
Only see channels the user is already a part of. In other words, only existing conversations that the user have.
Screenshots
I don't have a conversation with Ali. I shouldn't be able to see him when I type his name in the channels filter.
Additional context
In my app, a user has connections. So when he tries to send a message, he can only send a message to his connection. I have implemented this successfully like this:
`
useEffect(() => {
const fetchUsers = async () => {
if (!connectedUserData) {
setFetchError("Connected user data is not available");
return;
}
}, [searchInputDebounced, connectedUserData, client]);
`
I tried the same thing with filtering channels but it didn't work.
<ChannelList filters={{ type: "messaging", members:{ $and: [ { members: { $in: connectedUserData.connections.map(user => user)} }, // Existing condition:
connectedUserData._idis in
members{ id: { $ne: connectedUserData._id } }, // New condition:
idis not equal to
connectedUserData._id], }, }} showChannelSearch options={{ state: true, presence: true, limit: 8 }} sort={{ last_message_at: -1 }} additionalChannelSearchProps={{ searchForChannels: true, searchQueryParams: { channelFilters: { filters: { $and: [ { members: { $in: connectedUserData.connections.map(user => user)} }, // Existing condition:
connectedUserData._idis in
members{ id: { $ne: connectedUserData._id } }, // New condition:
idis not equal to
connectedUserData._id], }, }, }, }} Preview={ChannelPreviewCustom} />
So I also I tried a simpler filter like the initial example I provided where I only filter by the connected user id but it did not work.
(While writing this, I realized it's redudant to filter channels by both connected user id and his connection requests. Since the user channels can be filtered by either of them. So one is enough.)
Package version
The text was updated successfully, but these errors were encountered: