Fix repository_row call when no repository row is selected [SCI-8281] (#5301)

This commit is contained in:
ajugo 2023-04-25 15:18:12 +02:00 committed by GitHub
parent db15297090
commit 9b49745194
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -65,7 +65,7 @@
$('#modal-info-repository-row').modal('hide');
PrintModalComponent.row_ids = selectedRows;
} else {
PrintModalComponent.row_ids = RepositoryDatatable.selectedRows();
PrintModalComponent.row_ids = [...RepositoryDatatable.selectedRows()];
}
}
});

View file

@ -307,8 +307,8 @@ class RepositoryRowsController < ApplicationController
end
def load_repository_or_snapshot
@repository = Repository.accessible_by_teams(current_team).find_by(id: @repository_row.first.repository_id)
@repository ||= RepositorySnapshot.find_by(id: @repository_row.first.repository_id)
@repository = Repository.accessible_by_teams(current_team).find_by(id: @repository_row&.first&.repository_id)
@repository ||= RepositorySnapshot.find_by(id: @repository_row&.first&.repository_id)
render_404 unless @repository
end