The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/server/startup/roomPublishes.coffee

64 lines
1.7 KiB

Meteor.startup ->
RocketChat.roomTypes.setPublish 'c', (identifier) ->
options =
fields:
name: 1
t: 1
cl: 1
u: 1
usernames: 1
topic: 1
muted: 1
archived: 1
ro: 1
jitsiTimeout: 1
description: 1
sysMes: 1
joinCodeRequired: 1
if RocketChat.authz.hasPermission(this.userId, 'view-join-code')
options.fields.joinCode = 1
if RocketChat.authz.hasPermission(this.userId, 'view-c-room')
return RocketChat.models.Rooms.findByTypeAndName 'c', identifier, options
else if RocketChat.authz.hasPermission(this.userId, 'view-joined-room')
roomId = RocketChat.models.Subscriptions.findByTypeNameAndUserId('c', identifier, this.userId).fetch()
if roomId.length > 0
return RocketChat.models.Rooms.findById(roomId[0]?.rid, options)
return this.ready()
RocketChat.roomTypes.setPublish 'p', (identifier) ->
options =
fields:
name: 1
t: 1
cl: 1
u: 1
usernames: 1
topic: 1
muted: 1
archived: 1
ro: 1
jitsiTimeout: 1
description: 1
sysMes: 1
user = RocketChat.models.Users.findOneById this.userId, fields: username: 1
return RocketChat.models.Rooms.findByTypeAndNameContainingUsername 'p', identifier, user.username, options
RocketChat.roomTypes.setPublish 'd', (identifier) ->
options =
fields:
name: 1
t: 1
cl: 1
u: 1
usernames: 1
topic: 1
jitsiTimeout: 1
user = RocketChat.models.Users.findOneById this.userId, fields: username: 1
if RocketChat.authz.hasAtLeastOnePermission(this.userId, ['view-d-room', 'view-joined-room'])
return RocketChat.models.Rooms.findByTypeContainigUsernames 'd', [user.username, identifier], options
return this.ready()