From 4b937c65c5947d0239e1245c2cb60ea8bdceff4c Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 7 Aug 2019 15:43:29 -0300 Subject: [PATCH] [FIX] Direct Message names not visible on Admin panel (#15114) --- app/lib/lib/roomTypes/direct.js | 4 ---- app/ui-admin/client/rooms/adminRooms.js | 8 +++----- app/utils/lib/RoomTypeConfig.js | 9 --------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/app/lib/lib/roomTypes/direct.js b/app/lib/lib/roomTypes/direct.js index 8499332c8918..a0226c51f943 100644 --- a/app/lib/lib/roomTypes/direct.js +++ b/app/lib/lib/roomTypes/direct.js @@ -101,10 +101,6 @@ export class DirectMessageRoomType extends RoomTypeConfig { return Session.get(`user_${ subscription.name }_status_text`); } - getDisplayName(room) { - return room.usernames.join(' x '); - } - allowRoomSettingChange(room, setting) { switch (setting) { case RoomSettingsEnum.NAME: diff --git a/app/ui-admin/client/rooms/adminRooms.js b/app/ui-admin/client/rooms/adminRooms.js index 96a30d949da8..1492fdf88994 100644 --- a/app/ui-admin/client/rooms/adminRooms.js +++ b/app/ui-admin/client/rooms/adminRooms.js @@ -12,18 +12,19 @@ import { SideNav, RocketChatTabBar, TabBar } from '../../../ui-utils'; import { t, roomTypes } from '../../../utils'; import { hasAllPermission } from '../../../authorization'; import { ChannelSettings } from '../../../channel-settings'; +import { getAvatarURL } from '../../../utils/lib/getAvatarURL'; export const AdminChatRoom = new Mongo.Collection('rocketchat_room'); Template.adminRooms.helpers({ url() { - return roomTypes.getConfig(this.t).getAvatarPath(this); + return this.t === 'd' ? getAvatarURL({ username: `@${ this.usernames[0] }` }) : roomTypes.getConfig(this.t).getAvatarPath(this); }, getIcon() { return roomTypes.getIcon(this); }, roomName() { - return roomTypes.getRoomName(this.t, this); + return this.t === 'd' ? this.usernames.join(' x ') : roomTypes.getRoomName(this.t, this); }, searchText() { const instance = Template.instance(); @@ -52,9 +53,6 @@ Template.adminRooms.helpers({ const rooms = Template.instance().rooms(); return rooms && rooms.count(); }, - name() { - return roomTypes.roomTypes[this.t].getDisplayName(this); - }, type() { return TAPi18n.__(roomTypes.roomTypes[this.t].label); }, diff --git a/app/utils/lib/RoomTypeConfig.js b/app/utils/lib/RoomTypeConfig.js index cb6e022942dd..0cd3c7ff4c21 100644 --- a/app/utils/lib/RoomTypeConfig.js +++ b/app/utils/lib/RoomTypeConfig.js @@ -150,15 +150,6 @@ export class RoomTypeConfig { return this._route; } - /** - * Gets the room's name to display in the UI. - * - * @param {object} room - */ - getDisplayName(room) { - return room.name; - } - allowRoomSettingChange(/* room, setting */) { return true; }