Closed Harsh2110mishra closed 6 months ago
Hey @Harsh2110mishra, do you have any filters added to the Channel List? If you have filters this behaviour should not ideally occur.
Hey @Harsh2110mishra, did the above solution work for you?
Hi @khushal87 How can I apply filters in above code? As you can I don't have the access to uid
which I used to create a channel for two users when current user open messages.js
screen.
I have only access to current user id i.e userInfo?.data?._id
.
<ChannelList
/** I don't have the access to uid here*/
onSelect={(channel) => {
// THIS IS WHERE ISSUE OCCURS
// Channel will be set in hook and user will be redirected to chat screen with channel object
setIsChannelCreated(channel);
}}
/>
@khushal87 what if I pass only current user id in filter? Does it resolve the above issue?
like this:
const filter = {
type: "messaging",
members: { $in: [`${userInfo?.data?._id}`] },
};
Hey @Harsh2110mishra, passing the filter with the appropriate user id shall solve your issue.
Does it resolve the above issue?
Please test it on your end and let us know.
Yes, it's working. @khushal87
Issue
Unwated channels are created with different other users when any user creates a
messaging
channel with one user. Let's assume if user A sends a message to user B, User A sends message to user C now if user B opensmessages
screen to read message sent by user A then user C will get multiple channels with User A and User C. Now, user C can also read the conversations of User A and User B as it is included in channels through this bug.Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
Users can read or send messages to only user they wanted to.
Project Related Information
Customization
Click To Expand
```typescript jsx # ChannelList ```
Offline support
Environment
Click To Expand
#### `package.json`: ```json # "stream-chat": "^8.2.1", # "stream-chat-react-native": "^5.24.0" ``` **`react-native info` output:** ``` System: OS: macOS 11.7.8 CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz Memory: 43.59 MB / 8.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.21.3 - /usr/local/opt/node@14/bin/node Yarn: Not Found npm: 6.14.18 - /usr/local/opt/node@14/bin/npm Watchman: 2023.05.22.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.12.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild Languages: Java: 17.0.7 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.4 => 0.70.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found info React Native v0.73.4 is now available (your project is running on v0.70.4). ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [x] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [x] Both - **`stream-chat-react-native` version you're using that has this issue:** - `^5.24.0` - Device/Emulator info: - [x] I am using a physical device - OS version: `Android 11` - Device/Emulator: `iPhone 13`
Additional context
I have tested this issue with different version of
stream-chat-react-native
library but still issue persists. I have shared my code for the suggestion if I am doing something wrong.Code:
Screenshots
Click To Expand
![2207c868-8158-44de-8825-83da12db8827](https://github.com/GetStream/stream-chat-react-native/assets/50140154/3b9639a1-f795-4d50-a705-0b48106452ed)