diff options
author | Martin Cabrera <martin@kisland.com> | 2017-01-16 22:23:30 +0300 |
---|---|---|
committer | Martin Cabrera <martin@kisland.com> | 2017-01-16 22:23:30 +0300 |
commit | 9844c1f222fa910fc5fe23de0821c83a095d84f9 (patch) | |
tree | dea3cf7f7b012a55b962bfd93194af00689229a9 /app | |
parent | 87c39b6d393d211c038bff084a3f8d21f0391d71 (diff) |
Refactored ‘from’ and ‘to’ variable preservation
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/compare_controller.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 91793cc3650..2ab381f6850 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -27,8 +27,11 @@ class Projects::CompareController < Projects::ApplicationController def create if params[:from].blank? || params[:to].blank? flash[:alert] = "You must select from and to branches" - from_to_preservation = from_to_hash(params) - redirect_to namespace_project_compare_index_path(@project.namespace, @project, from_to_preservation) + from_to_vars = { + from: params[:from].presence, + to: params[:to].presence + } + redirect_to namespace_project_compare_index_path(@project.namespace, @project, from_to_vars) else redirect_to namespace_project_compare_path(@project.namespace, @project, params[:from], params[:to]) @@ -62,11 +65,4 @@ class Projects::CompareController < Projects::ApplicationController @merge_request ||= MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened. find_by(source_project: @project, source_branch: @head_ref, target_branch: @start_ref) end - - def from_to_hash(params) - return_hash = {} - return_hash[:from] = params[:from].presence - return_hash[:to] = params[:to].presence - return_hash - end -end +end
\ No newline at end of file |