Add images to tasks
Everyone who may comment on a task sends images to it, e.g. photos taken with a phone. The server stores an upright, at most 2560 px JPEG without EXIF data (no location) and a 400 px thumbnail on the private disk, served only to those who see the job. Uploaders change captions (also the alt text) and remove their own images; admin and management may remove anyone's (jobs.remove-any-task-image). Removing a task also removes its image files. Livewire's temporary upload limit is raised to PHP's 40 MB so that the page's own 12 MB limit gives a translated message. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -9,6 +9,8 @@ use App\Modules\Jobs\Application\Contracts\ChecklistQueries;
|
||||
use App\Modules\Jobs\Application\Contracts\CustomerJobQueries;
|
||||
use App\Modules\Jobs\Application\Contracts\TaskCalendarQueries;
|
||||
use App\Modules\Jobs\Application\Contracts\TaskCommentQueries;
|
||||
use App\Modules\Jobs\Application\Contracts\TaskImageFiles;
|
||||
use App\Modules\Jobs\Application\Contracts\TaskImageQueries;
|
||||
use App\Modules\Jobs\Application\Contracts\TaskQueries;
|
||||
use App\Modules\Jobs\Application\Contracts\TaskUsage;
|
||||
use App\Modules\Jobs\Domain\Contracts\ChecklistItemRepository;
|
||||
@@ -16,9 +18,11 @@ use App\Modules\Jobs\Domain\Contracts\CustomerJobRepository;
|
||||
use App\Modules\Jobs\Domain\Contracts\JobNumberSequence;
|
||||
use App\Modules\Jobs\Domain\Contracts\TaskBookingRepository;
|
||||
use App\Modules\Jobs\Domain\Contracts\TaskCommentRepository;
|
||||
use App\Modules\Jobs\Domain\Contracts\TaskImageRepository;
|
||||
use App\Modules\Jobs\Domain\Contracts\TaskRepository;
|
||||
use App\Modules\Jobs\Infrastructure\CustomerReferencesFromJobs;
|
||||
use App\Modules\Jobs\Infrastructure\CustomerRowUsageFromJobs;
|
||||
use App\Modules\Jobs\Infrastructure\Files\GdTaskImageFiles;
|
||||
use App\Modules\Jobs\Infrastructure\NothingUsesTasks;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\DatabaseJobNumberSequence;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentChecklistItemRepository;
|
||||
@@ -29,6 +33,8 @@ use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskBooking
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskCalendarQueries;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskCommentQueries;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskCommentRepository;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskImageQueries;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskImageRepository;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskQueries;
|
||||
use App\Modules\Jobs\Infrastructure\Persistence\Repositories\EloquentTaskRepository;
|
||||
use App\Modules\Users\Domain\Enums\Role;
|
||||
@@ -58,6 +64,9 @@ class JobsServiceProvider extends ServiceProvider
|
||||
ChecklistQueries::class => EloquentChecklistQueries::class,
|
||||
TaskCommentRepository::class => EloquentTaskCommentRepository::class,
|
||||
TaskCommentQueries::class => EloquentTaskCommentQueries::class,
|
||||
TaskImageRepository::class => EloquentTaskImageRepository::class,
|
||||
TaskImageQueries::class => EloquentTaskImageQueries::class,
|
||||
TaskImageFiles::class => GdTaskImageFiles::class,
|
||||
// Replaced by the TimeTracking module, which knows which tasks have time entries.
|
||||
TaskUsage::class => NothingUsesTasks::class,
|
||||
];
|
||||
@@ -106,6 +115,10 @@ class JobsServiceProvider extends ServiceProvider
|
||||
// their own comments, and admin and management may remove anyone's.
|
||||
Gate::define('jobs.remove-any-task-comment', $isManager);
|
||||
|
||||
// Images on tasks likewise: anyone who comments sends images, uploaders change captions and
|
||||
// remove their own images, and admin and management may remove anyone's.
|
||||
Gate::define('jobs.remove-any-task-image', $isManager);
|
||||
|
||||
// "Lasku luotu" and "Laskutettu" are set when invoicing: management or the job's biller.
|
||||
// The argument is the job's biller (user id), when known.
|
||||
Gate::define('jobs.set-billing-status', fn (User $user, ?int $billerUserId = null): bool => $isManager($user)
|
||||
|
||||
Reference in New Issue
Block a user