[NEW] REST API endpoint channels.setDefault#10941
Merged
rodrigok merged 18 commits intoRocketChat:developfrom Jun 20, 2018
Merged
[NEW] REST API endpoint channels.setDefault#10941rodrigok merged 18 commits intoRocketChat:developfrom
channels.setDefault#10941rodrigok merged 18 commits intoRocketChat:developfrom
Conversation
cardoso
requested changes
May 30, 2018
| const findResult = findChannelByIdOrName({ params: this.requestParams() }); | ||
|
|
||
| if (findResult.default === this.bodyParams.default) { | ||
| return RocketChat.API.v1.failure('The channel default setting is the same as what it would be changed to.'); |
Member
There was a problem hiding this comment.
Missing localization key here
return RocketChat.API.v1.failure('The channel default setting is the same as what it would be changed to.', 'error-channels-setdefault-is-same');| RocketChat.API.v1.addRoute('channels.setDefault', { authRequired: true }, { | ||
| post() { | ||
| if (typeof this.bodyParams.default === 'undefined') { | ||
| return RocketChat.API.v1.failure('The bodyParam "default" is required'); |
Member
There was a problem hiding this comment.
Missing localization key here
return RocketChat.API.v1.failure('The bodyParam "default" is required', 'error-channels-setdefault-missing-default-param');
Contributor
Author
|
@cardoso The localization keys for this are located in the same file as all others, right? |
Contributor
Author
|
@cardoso That should do it~ |
cardoso
approved these changes
May 31, 2018
MarcosSpessatto
approved these changes
Jun 8, 2018
channels.setDefault
Contributor
|
@vynmera Will this work when calling channels.create? Currently it takes: Will it now take {"default": true} ? |
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10939.
This PR adds a simple new REST API route
channels.setDefaultto set a channel as default. It behaves the same aschannels.setReadOnly:POST /api/v1/channels.setDefault (requires auth){ "roomId": "YOUR_ROOM_ID", "default": true }A docs PR is on the way.