Conversation
Add bulk license update functionality with API endpoint, request validation, frontend dialog, and context menu integration across all gallery views. Backend: - SetPhotosLicenseRequest with authorization and validation - PhotoController::license() with chunked batch processing (100 photos/batch) - PATCH /Photo::license route - 7 comprehensive tests (401/403/422/204 scenarios) Frontend: - PhotoLicenseDialog component with PrimeVue Select (31 license types) - Integration in Album, Tag, Timeline, Search views - Context menu items: 'License' (single) and 'License Selected' (bulk) - galleryModals composable toggleLicense trigger - ModalsState is_license_visible flag Translations: - English translations for dialog and menu labels - Placeholders added to 21 other languages (ar, bg, cz, de, el, es, fa, fr, hu, it, ja, nl, no, pl, pt, ru, sk, sv, vi, zh_CN, zh_TW) Spec impact: Marked tasks T-016-01 through T-016-14 complete in tasks.md. Updated roadmap status. Feature ready for manual testing (T-016-15 to T-016-24).
📝 WalkthroughWalkthroughAdds a bulk photo license feature: backend request/endpoint for batched transactional updates, frontend dialog and modal wiring across gallery panels, translations for many locales, tests, and documentation for the feature rollout. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
resources/js/composables/contextMenus/contextMenu.ts (1)
145-150: Consider using a distinct icon for the license action.The license menu items use
pi pi-id-card, which is also used forsetAsCover(Line 116). While functionally correct, using a different icon (e.g.,pi pi-file-checkorpi pi-verified) could improve visual distinction between these actions.🔧 Optional icon differentiation
{ label: "gallery.menus.license", - icon: "pi pi-id-card", + icon: "pi pi-file-check", callback: photoCallbacks.toggleLicense, access: albumStore.rights?.can_edit ?? false, },Apply the same change to the
license_allentry at Line 227.Also applies to: 226-231
resources/js/components/forms/photo/PhotoLicenseDialog.vue (1)
71-72: Guard condition will never trigger.The check
selectedLicense.value === undefinedwill never be true sinceselectedLicenseis initialized to"none"on Line 63 and reset to"none"inclose(). Consider removing this dead code or adjusting the guard to check for a meaningful invalid state if needed.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (64)
app/Http/Controllers/Gallery/PhotoController.phpapp/Http/Requests/Photo/SetPhotosLicenseRequest.phpdocs/specs/4-architecture/features/016-bulk-license-edit/plan.mddocs/specs/4-architecture/features/016-bulk-license-edit/spec.mddocs/specs/4-architecture/features/016-bulk-license-edit/tasks.mddocs/specs/4-architecture/roadmap.mdlang/ar/dialogs.phplang/ar/gallery.phplang/bg/dialogs.phplang/bg/gallery.phplang/cz/dialogs.phplang/cz/gallery.phplang/de/dialogs.phplang/de/gallery.phplang/el/dialogs.phplang/el/gallery.phplang/en/dialogs.phplang/en/gallery.phplang/es/dialogs.phplang/es/gallery.phplang/fa/dialogs.phplang/fa/gallery.phplang/fr/dialogs.phplang/fr/gallery.phplang/hu/dialogs.phplang/hu/gallery.phplang/it/dialogs.phplang/it/gallery.phplang/ja/dialogs.phplang/ja/gallery.phplang/nl/dialogs.phplang/nl/gallery.phplang/no/dialogs.phplang/no/gallery.phplang/pl/dialogs.phplang/pl/gallery.phplang/pt/dialogs.phplang/pt/gallery.phplang/ru/dialogs.phplang/ru/gallery.phplang/sk/dialogs.phplang/sk/gallery.phplang/sv/dialogs.phplang/sv/gallery.phplang/vi/dialogs.phplang/vi/gallery.phplang/zh_CN/dialogs.phplang/zh_CN/gallery.phplang/zh_TW/dialogs.phplang/zh_TW/gallery.phpresources/js/components/forms/photo/PhotoLicenseDialog.vueresources/js/components/gallery/albumModule/AlbumPanel.vueresources/js/components/gallery/tagModule/TagPanel.vueresources/js/composables/contextMenus/contextMenu.tsresources/js/composables/modalsTriggers/galleryModals.tsresources/js/services/photo-service.tsresources/js/stores/ModalsState.tsresources/js/utils/Helpers.tsresources/js/views/gallery-panels/Album.vueresources/js/views/gallery-panels/Search.vueresources/js/views/gallery-panels/Tag.vueresources/js/views/gallery-panels/Timeline.vueroutes/api_v2.phptests/Feature_v2/Photo/PhotoBulkLicenseTest.php
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/Http/Controllers/Gallery/PhotoController.php (1)
295-308: Variable naming:$photo_idshould reflect that it's a chunk collection.The variable
$photo_idin the chunk callback receives a collection of IDs, not a single ID. This naming is misleading and could cause confusion.♻️ Suggested rename for clarity
public function license(SetPhotosLicenseRequest $request): void { $license = $request->license(); $photo_ids = collect($request->photoIds()); DB::transaction(function () use ($photo_ids, $license): void { // Process photos in chunks of 100 to avoid memory issues - $photo_ids->chunk(100)->each(function ($photo_id) use ($license): void { - Photo::query()->whereIn('id', $photo_id)->update(['license' => $license->value]); + $photo_ids->chunk(100)->each(function ($chunk) use ($license): void { + Photo::query()->whereIn('id', $chunk)->update(['license' => $license->value]); }); }); }
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
app/Http/Controllers/Gallery/PhotoController.phpapp/Http/Requests/Photo/SetPhotosLicenseRequest.phpapp/Http/Requests/Photo/WatermarkPhotoRequest.phpapp/Http/Requests/Traits/Authorize/AuthorizeCanEditPhotosByIdTrait.php
🚧 Files skipped from review as they are similar to previous changes (1)
- app/Http/Requests/Photo/SetPhotosLicenseRequest.php
Summary by CodeRabbit
New Features
UI
Localization
Documentation
Tests