diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-01-19 09:00:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-19 09:00:13 -0500 |
commit | d3a285e64d051aa8d5c4c9854597dfbcce107675 (patch) | |
tree | e16ca3d52b6347a754e506aa8cac7457c62d3639 /api/command_invite_people.go | |
parent | 61b7226533568f3261fc233538ce998bb71a5345 (diff) | |
download | chat-d3a285e64d051aa8d5c4c9854597dfbcce107675.tar.gz chat-d3a285e64d051aa8d5c4c9854597dfbcce107675.tar.bz2 chat-d3a285e64d051aa8d5c4c9854597dfbcce107675.zip |
Migrate functions to app package (#5106)
* Refactor and move session logic into app package
* Refactor email functions into the app package
* Refactor password update into app package
* Migrate user functions to app package
* Move team functions into app package
* Migrate channel functions into app package
* Pass SiteURL through to app functions
* Update based on feedback
Diffstat (limited to 'api/command_invite_people.go')
-rw-r--r-- | api/command_invite_people.go | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/api/command_invite_people.go b/api/command_invite_people.go index f3818628f..ef2449ebc 100644 --- a/api/command_invite_people.go +++ b/api/command_invite_people.go @@ -41,9 +41,6 @@ func (me *InvitePeopleProvider) DoCommand(c *Context, args *model.CommandArgs, m return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.email_off")} } - tchan := app.Srv.Store.Team().Get(c.TeamId) - uchan := app.Srv.Store.User().Get(c.Session.UserId) - emailList := strings.Fields(message) for i := len(emailList) - 1; i >= 0; i-- { @@ -57,23 +54,10 @@ func (me *InvitePeopleProvider) DoCommand(c *Context, args *model.CommandArgs, m return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.no_email")} } - var team *model.Team - if result := <-tchan; result.Err != nil { - c.Err = result.Err + if err := app.InviteNewUsersToTeam(emailList, c.TeamId, c.Session.UserId, c.GetSiteURL()); err != nil { + c.Err = err return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.fail")} - } else { - team = result.Data.(*model.Team) } - var user *model.User - if result := <-uchan; result.Err != nil { - c.Err = result.Err - return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.fail")} - } else { - user = result.Data.(*model.User) - } - - go InviteMembers(team, user.GetDisplayName(), emailList, c.GetSiteURL()) - return &model.CommandResponse{ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, Text: c.T("api.command.invite_people.sent")} } |