-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync createPrivateGroup and createChannel parameter order for readOnl…
…y and customFields
- Loading branch information
1 parent
6811201
commit 54379d1
Showing
6 changed files
with
22 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Meteor.methods | ||
createChannel: (name, members, readOnly) -> | ||
createChannel: (name, members, readOnly = false, customFields = {}) -> | ||
|
||
check name, String | ||
check members, Match.Optional([String]) | ||
|
||
if not Meteor.userId() | ||
throw new Meteor.Error 'error-invalid-user', "Invalid user", { method: 'createChannel' } | ||
|
||
if RocketChat.authz.hasPermission(Meteor.userId(), 'create-c') isnt true | ||
if not RocketChat.authz.hasPermission(Meteor.userId(), 'create-c') | ||
throw new Meteor.Error 'error-not-allowed', "Not allowed", { method: 'createChannel' } | ||
|
||
return RocketChat.createRoom('c', name, Meteor.user()?.username, members, readOnly); | ||
return RocketChat.createRoom('c', name, Meteor.user()?.username, members, readOnly, {customFields: customFields}); |
6 changes: 3 additions & 3 deletions
6
packages/rocketchat-lib/server/methods/createPrivateGroup.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Meteor.methods | ||
createPrivateGroup: (name, members, customFields) -> | ||
createPrivateGroup: (name, members, readOnly = false, customFields = {}) -> | ||
|
||
check name, String | ||
check members, Match.Optional([String]) | ||
|
||
if not Meteor.userId() | ||
throw new Meteor.Error 'error-invalid-user', "Invalid user", { method: 'createPrivateGroup' } | ||
|
||
unless RocketChat.authz.hasPermission(Meteor.userId(), 'create-p') | ||
if not RocketChat.authz.hasPermission(Meteor.userId(), 'create-p') | ||
throw new Meteor.Error 'error-not-allowed', "Not allowed", { method: 'createPrivateGroup' } | ||
|
||
return RocketChat.createRoom('p', name, Meteor.user()?.username, members, {customFields: customFields}); | ||
return RocketChat.createRoom('p', name, Meteor.user()?.username, members, readOnly, {customFields: customFields}); |