Skip to content

Commit 5e06375

Browse files
author
Dario Aubry
committed
fix error when user of lastMessage left the room
1 parent c4056d4 commit 5e06375

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ChatWindow/RoomsList.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,11 @@ export default {
159159
user => user._id === room.lastMessage.sender_id
160160
)
161161
162-
if (user._id === this.currentUserId) {
163-
return content
164-
}
162+
if (room.lastMessage.username) {
163+
return `${room.lastMessage.username} - ${content}`
164+
} else if (!user || user._id === this.currentUserId) {
165+
return content
166+
}
165167
166168
return `${user.username} - ${content}`
167169
}

0 commit comments

Comments
 (0)