gitlab-org--gitlab-foss/app/services/mattermost/create_team_service.rb
Z.J. van de Weg 52c4a7866e Improve UX
2017-03-02 10:21:29 +01:00

14 lines
423 B
Ruby

module Mattermost
class CreateTeamService < ::BaseService
def initialize(group, current_user)
@group, @current_user = group, current_user
end
def execute
# The user that creates the team will be Team Admin
Mattermost::Team.new(current_user).create(@group.mattermost_team_params)
rescue Mattermost::ClientError => e
@group.errors.add(:mattermost_team, e.message)
end
end
end