[NEW] Add methods to include room types on dashboard (#16576)

pull/16328/head^2
Marcos Spessatto Defendi 5 years ago committed by GitHub
parent 1056e69d93
commit 92164aabf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/lib/lib/roomTypes/direct.js
  2. 4
      app/lib/lib/roomTypes/private.js
  3. 4
      app/lib/lib/roomTypes/public.js
  4. 4
      app/utils/lib/RoomTypesCommon.js

@ -159,4 +159,8 @@ export class DirectMessageRoomType extends RoomTypeConfig {
getAvatarPath(roomData) {
return getUserAvatarURL(roomData.name || this.roomName(roomData));
}
includeInDashboard() {
return true;
}
}

@ -130,4 +130,8 @@ export class PrivateRoomType extends RoomTypeConfig {
// otherwise gets discussion's avatar via _id
return getRoomAvatarURL(roomData.prid);
}
includeInDashboard() {
return true;
}
}

@ -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);
}

@ -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.
*

Loading…
Cancel
Save