diff --git a/app/assets/javascripts/repositories/index.js b/app/assets/javascripts/repositories/index.js index a104ba328..a29e919aa 100644 --- a/app/assets/javascripts/repositories/index.js +++ b/app/assets/javascripts/repositories/index.js @@ -32,7 +32,7 @@ function initRepositoriesDataTable(tableContainer, archived = false) { var tableTemplate = $('#RepositoriesListTable').html(); - $.get($(tableTemplate).data('source'), {archived: archived}, function(data) { + $.get($(tableTemplate).data('source'), { archived: archived }, function(data) { if (REPOSITORIES_TABLE) REPOSITORIES_TABLE.destroy(); CHECKBOX_SELECTOR = null; $('.content-body').html(tableTemplate); diff --git a/app/services/repository_datatable_service.rb b/app/services/repository_datatable_service.rb index 775163ad3..8f7f6a41d 100644 --- a/app/services/repository_datatable_service.rb +++ b/app/services/repository_datatable_service.rb @@ -61,11 +61,10 @@ class RepositoryDatatableService end def fetch_rows(search_value) - repository_rows = if @repository.archived? - @repository.repository_rows - else - @repository.repository_rows.where(archived: @params[:archived] || false) - end + repository_rows = @repository.repository_rows + if @params[:archived] && !@repository.archived? + repository_rows = repository_rows.where(archived: @params[:archived]) + end @all_count = if @my_module && @params[:assigned] == 'assigned'