Skip to content

Commit 964c44d

Browse files
committed
added system user control for opposite user
1 parent 7d68759 commit 964c44d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

components/ChatHeader/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ const ChatHeader = ({
3232
const oppositeUserId = room
3333
? room.groupName
3434
? null
35-
: room.participants.find((id) => id !== selfUser?._id)
36-
: participants?.find((id) => id !== selfUser?._id);
35+
: room.participants.find(
36+
(id) => id !== selfUser?._id && !id.startsWith("system"),
37+
)
38+
: participants?.find(
39+
(id) => id !== selfUser?._id && !id.startsWith("system"),
40+
);
3741
const oppositeUser = users.find(({ _id }) => _id === oppositeUserId);
3842

3943
const renderMembersOrOnline = () => {

components/MessageList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const MessageList = ({ onPress }: MessageListProps) => {
7979
return room.groupName.toLowerCase();
8080
} else {
8181
const oppositeUserId = room.participants.find(
82-
(id) => id !== selfUser?._id,
82+
(id) => id !== selfUser?._id && !id.startsWith("system"),
8383
);
8484
return (
8585
users

components/RoomCard/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ const RoomCard = ({ room, onClickAction }: RoomCardProps) => {
120120

121121
const oppositeUserId = room.groupName
122122
? null
123-
: room.participants.find((id) => id !== selfUser?._id);
123+
: room.participants.find(
124+
(id) => id !== selfUser?._id && !id.startsWith("system"),
125+
);
124126
const oppositeUser = oppositeUserId
125127
? users.find((user: UserProps) => user._id === oppositeUserId)
126128
: null;

0 commit comments

Comments
 (0)