-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] Add REST API endpoints
channels.setCustomFields
and `groups.s…
…etCustomFields` (#9733) * Add channels.setCustomFields and groups.setCustomFields Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com> * Delete unused `user` parameter Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com> * Add tests for channels.setCustomFields and groups.setCustomFields Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com> * Fix lint Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com> * Fix lint Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com> * Propogate setCustomFields to Subscriptions Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com> * Fix semicolon Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com>
- Loading branch information
Showing
9 changed files
with
450 additions
and
1 deletion.
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
18 changes: 18 additions & 0 deletions
18
packages/rocketchat-channel-settings/server/functions/saveRoomCustomFields.js
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
RocketChat.saveRoomCustomFields = function(rid, roomCustomFields) { | ||
if (!Match.test(rid, String)) { | ||
throw new Meteor.Error('invalid-room', 'Invalid room', { | ||
'function': 'RocketChat.saveRoomCustomFields' | ||
}); | ||
} | ||
if (!Match.test(roomCustomFields, Object)) { | ||
throw new Meteor.Error('invalid-roomCustomFields-type', 'Invalid roomCustomFields type', { | ||
'function': 'RocketChat.saveRoomCustomFields' | ||
}); | ||
} | ||
const ret = RocketChat.models.Rooms.setCustomFieldsById(rid, roomCustomFields); | ||
|
||
// Update customFields of any user's Subscription related with this rid | ||
RocketChat.models.Subscriptions.updateCustomFieldsByRoomId(rid, roomCustomFields); | ||
|
||
return ret; | ||
}; |
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
Oops, something went wrong.