gitlab-org--gitlab-foss/app/helpers/compare_helper.rb
2018-10-26 11:09:48 +11:00

22 lines
609 B
Ruby

# frozen_string_literal: true
module CompareHelper
def create_mr_button?(from = params[:from], to = params[:to], project = @project)
from.present? &&
to.present? &&
from != to &&
can?(current_user, :create_merge_request_from, project) &&
project.repository.branch_exists?(from) &&
project.repository.branch_exists?(to)
end
def create_mr_path(from = params[:from], to = params[:to], project = @project)
project_new_merge_request_path(
project,
merge_request_source_branch: to,
merge_request: {
target_branch: from
}
)
end
end