summaryrefslogtreecommitdiff
path: root/app/helpers/compare_helper.rb
blob: dd2e713a54ef5bce61e40f2ef079c3529b1b300d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module CompareHelper
  def compare_to_mr_button?
    @project.merge_requests_enabled &&
      params[:from].present? &&
      params[:to].present? &&
      @repository.branch_names.include?(params[:from]) &&
      @repository.branch_names.include?(params[:to]) &&
      params[:from] != params[:to] &&
      !@refs_are_same
  end

  def compare_mr_path
    new_project_merge_request_path(@project, merge_request: { source_branch: params[:to], target_branch: params[:from] })
  end
end