|
|
|
@ -7,8 +7,7 @@ Template.membersList.helpers({ |
|
|
|
|
|
|
|
|
|
isGroupChat() { |
|
|
|
|
const room = ChatRoom.findOne(this.rid, { reactive: false }); |
|
|
|
|
return ['c', 'p'].includes(room.t) |
|
|
|
|
|| (RocketChat.roomTypes[room.t].isGroupChat && RocketChat.roomTypes[room.t].isGroupChat()); |
|
|
|
|
return RocketChat.roomTypes.roomTypes[room.t].isGroupChat(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
isDirectChat() { |
|
|
|
@ -88,12 +87,7 @@ Template.membersList.helpers({ |
|
|
|
|
const roomData = Session.get(`roomData${ this._id }`); |
|
|
|
|
if (!roomData) { return ''; } |
|
|
|
|
return (() => { |
|
|
|
|
switch (roomData.t) { |
|
|
|
|
case 'p': return RocketChat.authz.hasAtLeastOnePermission(['add-user-to-any-p-room', 'add-user-to-joined-room'], this._id); |
|
|
|
|
case 'c': return RocketChat.authz.hasAtLeastOnePermission(['add-user-to-any-c-room', 'add-user-to-joined-room'], this._id); |
|
|
|
|
default: |
|
|
|
|
return (RocketChat.roomTypes[roomData.t].canAddUser && RocketChat.roomTypes[roomData.t].canAddUser(roomData)) || false; |
|
|
|
|
} |
|
|
|
|
return RocketChat.roomTypes.roomTypes[roomData.t].canAddUser(roomData); |
|
|
|
|
})(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -139,8 +133,8 @@ Template.membersList.helpers({ |
|
|
|
|
tabBar: Template.currentData().tabBar, |
|
|
|
|
username: Template.instance().userDetail.get(), |
|
|
|
|
clear: Template.instance().clearUserDetail, |
|
|
|
|
showAll: ['c', 'p'].includes(room != null ? room.t : undefined) || (RocketChat.roomTypes[room.t].userDetailShowAll && RocketChat.roomTypes[room.t].userDetailShowAll(room)), |
|
|
|
|
hideAdminControls: ['c', 'p', 'd'].includes(room != null ? room.t : undefined) || !(RocketChat.roomTypes[room.t].userDetailShowAdmin && RocketChat.roomTypes[room.t].userDetailShowAdmin(room)), |
|
|
|
|
showAll: RocketChat.roomTypes.roomTypes[room.t].userDetailShowAll(room) || false, |
|
|
|
|
hideAdminControls: RocketChat.roomTypes.roomTypes[room.t].userDetailShowAdmin(room) || false, |
|
|
|
|
video: ['d'].includes(room != null ? room.t : undefined) |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
@ -166,7 +160,7 @@ Template.membersList.events({ |
|
|
|
|
|
|
|
|
|
const roomData = Session.get(`roomData${ template.data.rid }`); |
|
|
|
|
|
|
|
|
|
if (['c', 'p'].includes(roomData.t) || (RocketChat.roomTypes[roomData.t].canAddUser && RocketChat.roomTypes[roomData.t].canAddUser(roomData))) { |
|
|
|
|
if (RocketChat.roomTypes.roomTypes[roomData.t].canAddUser(roomData)) { |
|
|
|
|
return Meteor.call('addUserToRoom', { rid: roomData._id, username: doc.username }, function(error) { |
|
|
|
|
if (error) { |
|
|
|
|
return handleError(error); |
|
|
|
|