Skip to content

Commit

Permalink
[FIX] Avatar on sidebar when showing real names (#17286)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored Apr 14, 2020
1 parent 39c74d4 commit fd69a79
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/lib/lib/roomTypes/direct.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,23 @@ export class DirectMessageRoomType extends RoomTypeConfig {
}

getAvatarPath(roomData, subData) {
if (!roomData && !subData) {
return '';
}

if (this.isGroupChat(roomData)) {
return getAvatarURL({ username: roomData.uids.length + roomData.usernames.join() });
}

if (roomData) {
return getUserAvatarURL(roomData.name || this.roomName(roomData));
const sub = subData || Subscriptions.findOne({ rid: roomData._id }, { fields: { name: 1 } });

if (sub && sub.name) {
return getUserAvatarURL(sub.name);
}

const sub = subData || Subscriptions.findOne({ rid: roomData._id }, { fields: { name: 1 } });
return getUserAvatarURL(sub.name || this.roomName(roomData));
if (roomData) {
return getUserAvatarURL(roomData.name || this.roomName(roomData)); // rooms should have no name for direct messages...
}
}

includeInDashboard() {
Expand Down

0 comments on commit fd69a79

Please sign in to comment.