gitlab-org--gitlab-foss/app/helpers/compare_helper.rb

22 lines
610 B
Ruby
Raw Normal View History

module CompareHelper
def create_mr_button?(from = params[:from], to = params[:to], project = @project)
2015-05-09 17:51:50 -04:00
from.present? &&
to.present? &&
from != to &&
can?(current_user, :create_merge_request, project) &&
2015-05-09 17:51:50 -04:00
project.repository.branch_names.include?(from) &&
project.repository.branch_names.include?(to)
end
def create_mr_path(from = params[:from], to = params[:to], project = @project)
new_namespace_project_merge_request_path(
project.namespace,
project,
merge_request: {
source_branch: to,
target_branch: from
}
)
end
end