Improve repositories loading for archive/restore [SCI-4780]

This commit is contained in:
Oleksii Kriuchykhin 2020-06-24 12:01:38 +02:00
parent 29f62419bd
commit 8e0ed286fb

View file

@ -11,7 +11,8 @@ class RepositoriesController < ApplicationController
before_action :switch_team_with_param, only: :show
before_action :load_repository, except: %i(index create create_modal sidebar archive restore)
before_action :load_repositories, only: %i(index show sidebar)
before_action :load_repositories_for_archiving, only: %i(archive restore)
before_action :load_repositories_for_archiving, only: :archive
before_action :load_repositories_for_restoring, only: :restore
before_action :check_view_all_permissions, only: %i(index sidebar)
before_action :check_view_permissions, except: %i(index create_modal create update destroy parse_sheet import_records sidebar archive restore)
before_action :check_manage_permissions, only: %i(destroy destroy_modal rename_modal update)
@ -383,7 +384,11 @@ class RepositoriesController < ApplicationController
end
def load_repositories_for_archiving
@repositories = current_team.repositories.where(id: params[:repository_ids])
@repositories = current_team.repositories.active.where(id: params[:repository_ids])
end
def load_repositories_for_restoring
@repositories = current_team.repositories.archived.where(id: params[:repository_ids])
end
def set_inline_name_editing