Skip to content

Commit

Permalink
Merge pull request #4799 from RocketChat/add-users-to-default-channel…
Browse files Browse the repository at this point in the history
…-from-api

Add users to default channels when using REST API
  • Loading branch information
engelgabriel committed Oct 31, 2016
2 parents 048a017 + 7c3a445 commit 951e5bc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/rocketchat-api/server/routes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,13 @@ RocketChat.API.v1.addRoute 'users.create', authRequired: true,
if @bodyParams.customFields?
RocketChat.saveCustomFields(newUserId, @bodyParams.customFields)

user = RocketChat.models.Users.findOneById(newUserId)

if typeof @bodyParams.joinDefaultChannels is 'undefined' or @bodyParams.joinDefaultChannels
RocketChat.addUserToDefaultChannels(user)

return RocketChat.API.v1.success
user: RocketChat.models.Users.findOneById(newUserId)
user: user
catch e
return RocketChat.API.v1.failure e.name + ': ' + e.message

Expand Down

0 comments on commit 951e5bc

Please sign in to comment.