Class: Mattermost::CreateTeamService

Inherits:
BaseService show all
Defined in:
app/services/mattermost/create_team_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(group, current_user) ⇒ CreateTeamService

Returns a new instance of CreateTeamService.


5
6
7
# File 'app/services/mattermost/create_team_service.rb', line 5

def initialize(group, current_user)
  @group, @current_user = group, current_user
end

Instance Method Details

#executeObject


9
10
11
12
13
14
# File 'app/services/mattermost/create_team_service.rb', line 9

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