don't try to bulk update if egg doesn't even have a url (#1887)

This commit is contained in:
mristau 2025-11-13 05:47:38 +01:00 committed by GitHub
parent 108dad09fb
commit 20cb7850ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -49,9 +49,15 @@ class UpdateEggBulkAction extends BulkAction
$success = 0;
$failed = 0;
$skipped = 0;
/** @var Egg $egg */
foreach ($records as $egg) {
if ($egg->update_url === null) {
$skipped++;
continue;
}
try {
$eggImporterService->fromUrl($egg->update_url, $egg);
@ -67,7 +73,12 @@ class UpdateEggBulkAction extends BulkAction
Notification::make()
->title(trans_choice('admin/egg.updated', 2, ['count' => $success, 'total' => $records->count()]))
->body($failed > 0 ? trans('admin/egg.updated_failed', ['count' => $failed]) : null)
->body(
collect([
$failed > 0 ? trans('admin/egg.updated_failed', ['count' => $failed]) : null,
$skipped > 0 ? trans('admin/egg.updated_skipped', ['count' => $skipped]) : null,
])->filter()->join(' ')
)
->status($failed > 0 ? 'warning' : 'success')
->persistent()
->send();

View File

@ -101,6 +101,7 @@ return [
'update' => 'Update|Update selected',
'updated' => 'Egg updated|:count/:total Eggs updated',
'updated_failed' => ':count failed',
'updated_skipped' => ':count skipped',
'update_question' => 'Are you sure you want to update this egg?|Are you sure you want to update the selected eggs?',
'update_description' => 'If you made any changes to the egg they will be overwritten!|If you made any changes to the eggs they will be overwritten!',
'no_updates' => 'No updates for the selected eggs available',