Fix default scope bugs

This commit is contained in:
Mojca Lorber 2020-06-18 18:08:53 +02:00
parent 6e8062179c
commit 3d59bbd50e
3 changed files with 3 additions and 3 deletions

View file

@ -428,7 +428,7 @@ class RepositoriesController < ApplicationController
def selected_repos_params
process_ids = params[:selected_repos].map(&:to_i).uniq
Repository.where(id: process_ids, team_id: current_team).pluck(:id)
Repository.where(id: process_ids, team_id: current_team).with_archived.pluck(:id)
end
def repository_response(message)

View file

@ -7,13 +7,13 @@ module Repositories
ActiveRecord::Base.transaction do
@repositories.each do |repository|
log_activity(:archive_inventory, repository)
repository.archive!(@user)
RepositoryActions::ArchiveRowsService.call(repository: repository,
repository_rows: repository.repository_rows.pluck(:id),
user: @user,
team: @team)
log_activity(:archive_inventory, repository)
end
rescue ActiveRecord::RecordNotSaved
@errors[:archiving_error] = I18n.t('repositories.archive_inventories.unsuccess_flash')

View file

@ -26,7 +26,7 @@ module Repositories
private
def scoped_repositories(ids)
Repository.where(id: ids, team_id: @team).archived
Repository.where(id: ids, team_id: @team).with_archived
end
end
end