From bad26e2dab81239f3cb2e7e3ea76ba113415638c Mon Sep 17 00:00:00 2001 From: Tiago Botelho Date: Tue, 27 Nov 2018 16:27:36 +0000 Subject: [PATCH] Small code refactoring for condition circuit breaking Also adds Changelog entry --- app/controllers/projects/imports_controller.rb | 2 +- app/models/project_import_state.rb | 2 +- .../50341-cleanup-useless-project-import-attributes.yml | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/50341-cleanup-useless-project-import-attributes.yml diff --git a/app/controllers/projects/imports_controller.rb b/app/controllers/projects/imports_controller.rb index 641f45b3b56..a10e159ea1e 100644 --- a/app/controllers/projects/imports_controller.rb +++ b/app/controllers/projects/imports_controller.rb @@ -22,7 +22,7 @@ class Projects::ImportsController < Projects::ApplicationController def show if @project.import_finished? - if continue_params && continue_params[:to] + if continue_params&.key?(:to) redirect_to continue_params[:to], notice: continue_params[:notice] else redirect_to project_path(@project), notice: finished_notice diff --git a/app/models/project_import_state.rb b/app/models/project_import_state.rb index c80e612053c..488f0cb5971 100644 --- a/app/models/project_import_state.rb +++ b/app/models/project_import_state.rb @@ -73,7 +73,7 @@ class ProjectImportState < ActiveRecord::Base alias_method :no_import?, :none? def in_progress? - started? || scheduled? + scheduled? || started? end def started? diff --git a/changelogs/unreleased/50341-cleanup-useless-project-import-attributes.yml b/changelogs/unreleased/50341-cleanup-useless-project-import-attributes.yml new file mode 100644 index 00000000000..3893f14e15c --- /dev/null +++ b/changelogs/unreleased/50341-cleanup-useless-project-import-attributes.yml @@ -0,0 +1,6 @@ +--- +title: Removes all the irrelevant code and columns that were migrated from the Project + table over to the ProjectImportState table +merge_request: 21497 +author: +type: performance -- GitLab