HDInnovations / UNIT3D-Community-Edition

Private Torrent Tracker Built With Laravel, Livewire and AlpineJS.
GNU Affero General Public License v3.0
1.99k stars 379 forks source link

[Bug]"Error in donation system when deleting packages that have already been donated" #4277

Closed bilboss02 closed 1 week ago

bilboss02 commented 3 weeks ago

UNIT3D Version

8.3.2

PHP & Platform

PHP 8.3.12 Database 8.0.39-0ubuntu0.20.04.1

Laravel verion

11.28.1

Have you done this?

Expectation

display the page correctly /dashboard/donations

The problem is that packages you donated no longer exist. Basically, you can edit the package, but if you delete a package that someone donated before, you will get an error.

once you removed from the the database donations to packages that don't exist anymore the problem was solved

Description

STAFF DONATION PAGE DOES NOT LOAD /dashboard/donations

Stack trace & logs

Attempt to read property "cost" on null {"view":{"view":"/var/www/html/resources/views/Staff/donation/index.blade.php","data":[]},"userId":3,"exception":"[object] (Spatie\\LaravelIgnition\\Exceptions\\ViewException(code: 0): Attempt to read property \"cost\" on null at /var/www/html/resources/views/Staff/donation/index.blade.php:55)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(123): require('...')
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(124): Illuminate\\Filesystem\\Filesystem::Illuminate\\Filesystem\\{closure}()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php(58): Illuminate\\Filesystem\\Filesystem->getRequire()
#3 /var/www/html/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(22): Illuminate\\View\\Engines\\PhpEngine->evaluatePath()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(74): Livewire\\Mechanisms\\ExtendBlade\\ExtendedCompilerEngine->evaluatePath()

Upvote & Fund

Fund with Polar

HDVinnie commented 2 weeks ago

Ideally here if a package has been used in a donation it should fail validation to delete and instead make package active column to false. Or better yet we add soft deletes to packages and cover withTrashed packages on donations index.