summaryrefslogtreecommitdiff
path: root/app/helpers/compare_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/compare_helper.rb')
-rw-r--r--app/helpers/compare_helper.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/app/helpers/compare_helper.rb b/app/helpers/compare_helper.rb
index 01847c6b807..fe339d32155 100644
--- a/app/helpers/compare_helper.rb
+++ b/app/helpers/compare_helper.rb
@@ -1,21 +1,21 @@
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] &&
+ def create_mr_button?(from = params[:from], to = params[:to], project = @project)
+ project.merge_requests_enabled &&
+ from.present? &&
+ to.present? &&
+ project.repository.branch_names.include?(from) &&
+ project.repository.branch_names.include?(to) &&
+ from != to &&
!@refs_are_same
end
- def compare_mr_path
+ def create_mr_path(from = params[:from], to = params[:to], project = @project)
new_namespace_project_merge_request_path(
- @project.namespace,
- @project,
+ project.namespace,
+ project,
merge_request: {
- source_branch: params[:to],
- target_branch: params[:from]
+ source_branch: to,
+ target_branch: from
}
)
end