2021-07-23 08:09:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# NOTE: This controller does not inherit from JiraConnect::ApplicationController
|
|
|
|
# because we don't receive a JWT for this action, so we rely on standard GitLab authentication.
|
|
|
|
class JiraConnect::BranchesController < ApplicationController
|
|
|
|
feature_category :integrations
|
|
|
|
|
|
|
|
def new
|
2021-08-04 14:09:57 -04:00
|
|
|
@new_branch_data = new_branch_data
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def initial_branch_name
|
2021-07-23 08:09:05 -04:00
|
|
|
return unless params[:issue_key].present?
|
|
|
|
|
2021-08-04 14:09:57 -04:00
|
|
|
Issue.to_branch_name(
|
2021-07-23 08:09:05 -04:00
|
|
|
params[:issue_key],
|
|
|
|
params[:issue_summary]
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2021-08-04 14:09:57 -04:00
|
|
|
def new_branch_data
|
|
|
|
{
|
|
|
|
initial_branch_name: initial_branch_name,
|
|
|
|
success_state_svg_path: ActionController::Base.helpers.image_path('illustrations/merge_requests.svg')
|
|
|
|
}
|
2021-07-23 08:09:05 -04:00
|
|
|
end
|
|
|
|
end
|