2017-06-13 18:12:31 -04:00
|
|
|
class Projects::MergeRequests::ApplicationController < Projects::ApplicationController
|
|
|
|
before_action :check_merge_requests_available!
|
|
|
|
before_action :merge_request
|
|
|
|
before_action :authorize_read_merge_request!
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def merge_request
|
|
|
|
@issuable = @merge_request ||= @project.merge_requests.find_by!(iid: params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def merge_request_params
|
2017-07-03 13:25:37 -04:00
|
|
|
params.require(:merge_request).permit(merge_request_params_attributes)
|
2017-06-13 18:12:31 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def merge_request_params_attributes
|
|
|
|
[
|
2018-05-22 21:54:57 -04:00
|
|
|
:allow_collaboration,
|
2017-06-13 18:12:31 -04:00
|
|
|
:assignee_id,
|
|
|
|
:description,
|
|
|
|
:force_remove_source_branch,
|
|
|
|
:lock_version,
|
|
|
|
:milestone_id,
|
|
|
|
:source_branch,
|
|
|
|
:source_project_id,
|
|
|
|
:state_event,
|
2018-05-29 05:51:43 -04:00
|
|
|
:squash,
|
2017-06-13 18:12:31 -04:00
|
|
|
:target_branch,
|
|
|
|
:target_project_id,
|
|
|
|
:task_num,
|
|
|
|
:title,
|
2017-08-30 10:57:50 -04:00
|
|
|
:discussion_locked,
|
2017-06-13 18:12:31 -04:00
|
|
|
label_ids: []
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_pipeline_variables
|
|
|
|
@pipelines = @merge_request.all_pipelines
|
|
|
|
@pipeline = @merge_request.head_pipeline
|
|
|
|
@statuses_count = @pipeline.present? ? @pipeline.statuses.relevant.count : 0
|
|
|
|
end
|
|
|
|
end
|