Skip to content

Commit 0e07787

Browse files
authored
Merge pull request #42 from aubrydario/fix-lastmessage
fix #41 error when user of lastMessage left the room
2 parents c4056d4 + 5e06375 commit 0e07787

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)