Conversation
📝 WalkthroughWalkthroughAdds a renamer preview API and wiring plus optional per-run rule filtering; extends renamer constructors to accept rule IDs; adds frontend dialogs, context-menu integrations, watermark confirmation, translations, docs, and tests for preview and apply flows. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~70 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: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/specs/4-architecture/open-questions.md (1)
1766-1766:⚠️ Potential issue | 🟡 MinorUpdate the "Last updated" date.
The footer shows
*Last updated: 2026-01-02*but this file was modified today with Q-017-01 and Q-017-02 entries. As per coding guidelines, the date should reflect the actual update date.📝 Proposed fix
-*Last updated: 2026-01-02* +*Last updated: 2026-02-26*resources/js/composables/contextMenus/contextMenu.ts (1)
348-375:⚠️ Potential issue | 🟡 MinorMissing "Apply Renamer Rules" option for multi-album selection.
The
albumsMenu()function doesn't include thetoggleApplyRenameraction. Per FR-017-08 in the spec, when one or more albums are selected, the "Apply Renamer Rules" option should appear. Single album selection (line 306-311) has it, but multi-album is missing.🔧 Proposed fix to add apply_renamer_all to albumsMenu
function albumsMenu() { + const leftMenuStore = useLeftMenuStateStore(); return [ { label: "gallery.menus.merge_all", icon: "pi pi-arrow-down-left-and-arrow-up-right-to-center", callback: albumCallbacks.toggleMerge, access: selectors.selectedAlbums?.value.reduce(canMove, true), }, + { + label: "gallery.menus.apply_renamer_all", + icon: "pi pi-pencil", + callback: albumCallbacks.toggleApplyRenamer, + access: selectors.selectedAlbums?.value.reduce( + (acc, album) => acc && album.rights.can_edit, + true + ) && (leftMenuStore.initData?.modules.is_mod_renamer_enabled ?? false), + }, { label: "gallery.menus.move_all",
🧹 Nitpick comments (7)
lang/ja/gallery.php (1)
121-122: New translation values are in English, not Japanese.The newly added keys (
apply_renamer,watermark,apply_renamer_all) have English values in the Japanese locale file. While the file does have a mix of translated and untranslated strings, consider providing Japanese translations for consistency with other translated entries in this file.Suggested translations (please verify with a native speaker):
'apply_renamer' => 'リネーマールールを適用',(Apply Renamer Rules)'watermark' => 'ウォーターマーク',(Watermark)'apply_renamer' => 'リネーマーを適用',(Apply Renamer - in menus)'apply_renamer_all' => '選択項目にリネーマーを適用',(Apply Renamer to Selected)Also applies to: 260-261
lang/zh_CN/gallery.php (2)
121-122: Missing Chinese translations for new keys.These entries are in English but should be translated to Chinese for the zh_CN locale. Suggested translations:
- 'apply_renamer' => 'Apply Renamer Rules', - 'watermark' => 'Watermark', + 'apply_renamer' => '应用重命名规则', + 'watermark' => '水印',
260-261: Missing Chinese translations for menu entries.These menu items should also be translated for consistency with the surrounding Chinese entries:
- 'apply_renamer' => 'Apply Renamer', - 'apply_renamer_all' => 'Apply Renamer to Selected', + 'apply_renamer' => '应用重命名', + 'apply_renamer_all' => '应用重命名到所选',lang/zh_TW/gallery.php (2)
121-122: Missing Traditional Chinese translations.These new entries contain English text instead of Traditional Chinese translations. Other strings in this locale file are properly translated (e.g., '釘選', '列表檢視', '公開但隱藏'). Consider translating these for consistency:
'apply_renamer' => '套用重新命名規則','watermark' => '浮水印',
260-261: Missing Traditional Chinese translations for menu items.Same issue as above — these menu entries use English text. Consider:
'apply_renamer' => '套用重新命名','apply_renamer_all' => '套用重新命名至所選項目',lang/hu/dialogs.php (1)
264-288: Localize the new Hungarian dialog strings (currently English).Lines 265-287 introduce new
hulocale entries, but the values are English. This works functionally, but it regresses locale consistency in Hungarian UI surfaces. Please localize these new keys (or explicitly document English fallback policy for this locale).tests/Feature_v2/RenamerRules/RenamerPreviewTest.php (1)
123-147: Consider cleanup of dynamically created rules.The
testPreviewNoChangesandtestPreviewRuleIdsFilteringtests create additionalRenamerRulerecords within the test method. While theDatabaseTransactionstrait should roll back these changes, it's worth verifying that theRequiresEmptyRenamerRulestrait properly handles cleanup.If cleanup becomes an issue, consider storing the rule ID and explicitly deleting it in the test, or relying on the trait's teardown. Current implementation should work given the transaction rollback.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (70)
app/Http/Controllers/RenamerController.phpapp/Http/Requests/Renamer/PreviewRenameRequest.phpapp/Http/Requests/Renamer/RenameRequest.phpapp/Metadata/Renamer/AlbumRenamer.phpapp/Metadata/Renamer/PhotoRenamer.phpapp/Metadata/Renamer/Renamer.phpdocs/specs/4-architecture/features/017-apply-renamer-rules/plan.mddocs/specs/4-architecture/features/017-apply-renamer-rules/spec.mddocs/specs/4-architecture/features/017-apply-renamer-rules/tasks.mddocs/specs/4-architecture/open-questions.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/album/ApplyRenamerDialog.vueresources/js/components/forms/album/WatermarkConfirmDialog.vueresources/js/components/gallery/albumModule/AlbumHero.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/renamer-service.tsresources/js/stores/ModalsState.tsresources/js/utils/Helpers.tsresources/js/views/gallery-panels/Albums.vueresources/js/views/gallery-panels/Search.vueresources/js/views/gallery-panels/Timeline.vueroutes/api_v2.phptests/Feature_v2/RenamerRules/RenamerPreviewTest.php
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
resources/js/components/forms/album/ApplyRenamerDialog.vue (1)
163-213:⚠️ Potential issue | 🟡 MinorHandle API failures and always clear loading state.
loadRules(),loadPreview(), andapplyRules()still have no failure path; this can leave loading UI stuck and gives no error feedback.🛠️ Suggested fix pattern
function loadRules() { is_loading_rules.value = true; RenamerService.list().then((response) => { rules.value = response.data; selected_rule_ids.value = rules.value.map((r) => r.id); - is_loading_rules.value = false; + }).catch(() => { + toast.add({ severity: "error", summary: trans("toasts.error"), life: 5000 }); + }).finally(() => { + is_loading_rules.value = false; }); } function loadPreview() { is_loading_preview.value = true; step.value = "preview"; RenamerService.preview({ ... }).then((response) => { preview_items.value = response.data; - is_loading_preview.value = false; + }).catch(() => { + toast.add({ severity: "error", summary: trans("toasts.error"), life: 5000 }); + }).finally(() => { + is_loading_preview.value = false; }); } function applyRules() { ... RenamerService.rename(data).then(() => { ... + }).catch(() => { + toast.add({ severity: "error", summary: trans("toasts.error"), life: 5000 }); }); }
🧹 Nitpick comments (1)
app/Actions/Renamer/PreviewPhotos.php (1)
49-55: Avoid materializing all descendant album IDs in memory.For large trees,
pluck('id')here can become expensive. Prefer constraining thewhereHas('albums', ...)subquery directly by_lft/_rgt.♻️ Suggested refactor
- $descendant_ids = Album::query() - ->where('_lft', '>=', $parent->_lft) - ->where('_rgt', '<=', $parent->_rgt) - ->pluck('id'); - $query->whereHas('albums', function ($q) use ($descendant_ids): void { - $q->whereIn('albums.id', $descendant_ids); + $query->whereHas('albums', function ($q) use ($parent): void { + $q->where('albums._lft', '>=', $parent->_lft) + ->where('albums._rgt', '<=', $parent->_rgt); });
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
app/Actions/Renamer/PreviewAlbums.phpapp/Actions/Renamer/PreviewPhotos.phpapp/Http/Controllers/RenamerController.phpapp/Http/Resources/Models/RenamerPreviewResource.phpresources/js/components/forms/album/ApplyRenamerDialog.vueresources/js/services/renamer-service.tstests/Feature_v2/RenamerRules/RenamerPreviewTest.php
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/Actions/Renamer/RenameAlbums.php (1)
45-45: Fix the inline comment wording for albums.Line 45 mentions “photo titles”, but this block updates album titles.
✏️ Suggested edit
- // Make a batch update to update all photo titles at once + // Make a batch update to update all album titles at once
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/Actions/Renamer/RenameAlbums.phpapp/Actions/Renamer/RenamePhotos.phpapp/Http/Controllers/RenamerController.php
Fixes #4051
Summary by CodeRabbit
New Features
Documentation
Tests
Localization