Skip to content

Commit

Permalink
fix user chats
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethemkizilyer committed Jul 5, 2024
1 parent db4bfea commit 192b6f2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Chat = () => {
return (
<div className="chat">
<div className="chatInfo">
<span>{data?.user?.username}</span>
<span>{data?.user?.username || data?.user?.displayName}</span>
<div className="chatIcons">
<BsCameraVideo />
<BiUserPlus />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ delete chats?.chats
<div className="userChat" key={chat[0]} onClick={()=>handleSelect(chat[1]?.userInfo)}>
<img src={chat[1]?.userInfo.avatar} alt="" />
<div className="userChatInfo">
<span>{chat[1]?.userInfo.username}</span>
<span>{chat[1]?.userInfo?.username || chat[1]?.userInfo?.displayName}</span>
<p>{chat[1]?.lastMessage?.text}</p>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ console.log(asd)
const combinedId =
currentUser.id > user.id
? currentUser.id + user.id
: user.uid + currentUser.id;
: user.id + currentUser.id;
try {
const res = await getDoc(doc(db, "chats", combinedId));

Expand All @@ -74,7 +74,7 @@ console.log(asd)
await updateDoc(doc(db, "userchats", user.id), {
[combinedId + ".userInfo"]: {
id: currentUser.id,
displayName: currentUser.username,
username: currentUser.username,
avatar: currentUser.avatar,
},
[combinedId + ".date"]: serverTimestamp(),
Expand Down

0 comments on commit 192b6f2

Please sign in to comment.