diff --git a/app/lib/lib/roomTypes/direct.js b/app/lib/lib/roomTypes/direct.js index a0226c51f943c..dc6a35a792756 100644 --- a/app/lib/lib/roomTypes/direct.js +++ b/app/lib/lib/roomTypes/direct.js @@ -159,4 +159,8 @@ export class DirectMessageRoomType extends RoomTypeConfig { getAvatarPath(roomData) { return getUserAvatarURL(roomData.name || this.roomName(roomData)); } + + includeInDashboard() { + return true; + } } diff --git a/app/lib/lib/roomTypes/private.js b/app/lib/lib/roomTypes/private.js index a418a4d436fc8..9de5cf1fac9a4 100644 --- a/app/lib/lib/roomTypes/private.js +++ b/app/lib/lib/roomTypes/private.js @@ -130,4 +130,8 @@ export class PrivateRoomType extends RoomTypeConfig { // otherwise gets discussion's avatar via _id return getRoomAvatarURL(roomData.prid); } + + includeInDashboard() { + return true; + } } diff --git a/app/lib/lib/roomTypes/public.js b/app/lib/lib/roomTypes/public.js index 50813c912a795..4cef013026a61 100644 --- a/app/lib/lib/roomTypes/public.js +++ b/app/lib/lib/roomTypes/public.js @@ -73,6 +73,10 @@ export class PublicRoomType extends RoomTypeConfig { return true; } + includeInDashboard() { + return true; + } + canAddUser(room) { return hasAtLeastOnePermission(['add-user-to-any-c-room', 'add-user-to-joined-room'], room._id); } diff --git a/app/utils/lib/RoomTypesCommon.js b/app/utils/lib/RoomTypesCommon.js index a98d5f716d169..abe097dbf8c92 100644 --- a/app/utils/lib/RoomTypesCommon.js +++ b/app/utils/lib/RoomTypesCommon.js @@ -11,6 +11,10 @@ export class RoomTypesCommon { this.mainOrder = 1; } + getTypesToShowOnDashboard() { + return Object.keys(this.roomTypes).filter((key) => this.roomTypes[key].includeInDashboard && this.roomTypes[key].includeInDashboard()); + } + /** * Adds a room type to the application. *