Module: DesignManagement::RunsDesignActions

Included in:
DeleteDesignsService, SaveDesignsService
Defined in:
app/services/design_management/runs_design_actions.rb

Constant Summary collapse

NoActions =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#run_actions(actions, skip_system_notes: false) ⇒ DesignManagement::Version

This concern requires the following methods to be implemented:

current_user, target_branch, repository, commit_message

Before calling ‘run_actions`, you should ensure the repository exists, by calling `repository.create_if_not_exists`.

Returns:

Raises:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/services/design_management/runs_design_actions.rb', line 15

def run_actions(actions, skip_system_notes: false)
  raise NoActions if actions.empty?

  sha = repository.commit_files(
    current_user,
    branch_name: target_branch,
    message: commit_message,
    actions: actions.map(&:gitaly_action)
  )

  ::DesignManagement::Version
    .create_for_designs(actions, sha, current_user)
    .tap { |version| post_process(version, skip_system_notes) }
end