Fix admin book genre hierarchy display#287
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
I'm not sure that this fixes the issue, because I did not understand it deeply (the original code is not so clear)... But anyway you can us it as a starting point of the research |
📝 WalkthroughWalkthroughLa sezione “Genere” ora costruisce una lista normalizzata e senza duplicati usando i dati cascade o fallback. Il test admin verifica inoltre la presenza di due link, diretti rispettivamente a radice e sottogenere. ChangesVisualizzazione dei generi
Estimated code review effort: 3 (Moderate) | ~15–30 minuti Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/Views/libri/scheda_libro.php`:
- Around line 242-244: Replace the `App\Support\HtmlHelper::e()` usage that
renders the genre list around `$addGenrePart` output with
`htmlspecialchars($gp[1], ENT_QUOTES, 'UTF-8')`. Keep the existing rendering
logic and escaping behavior unchanged otherwise, and do not use
`HtmlHelper::e()` anywhere in this view.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4e3694b8-b4c1-42d8-ba6d-e61b4791ddea
📒 Files selected for processing (2)
app/Views/libri/scheda_libro.phptests/full-test.spec.js
| $addGenrePart((int)($libro['radice_id'] ?? 0), $libro['radice_nome'] ?? null); | ||
| $addGenrePart((int)($libro['genere_id_cascade'] ?? $libro['genere_id'] ?? 0), $libro['genere_nome'] ?? null); | ||
| $addGenrePart((int)($libro['sottogenere_id_cascade'] ?? $libro['sottogenere_id'] ?? 0), $libro['sottogenere_nome'] ?? null); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Usare l’escaping previsto per le view.
La lista viene renderizzata alla Line 250 con App\Support\HtmlHelper::e($gp[1]). In app/Views/** va usato htmlspecialchars($gp[1], ENT_QUOTES, 'UTF-8').
As per path instructions, nelle view HtmlHelper::e() è vietato.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/Views/libri/scheda_libro.php` around lines 242 - 244, Replace the
`App\Support\HtmlHelper::e()` usage that renders the genre list around
`$addGenrePart` output with `htmlspecialchars($gp[1], ENT_QUOTES, 'UTF-8')`.
Keep the existing rendering logic and escaping behavior unchanged otherwise, and
do not use `HtmlHelper::e()` anywhere in this view.
Source: Path instructions
The admin book detail page could render a root + direct-child genre as
Genre: [Comic Book](id:182) → [Manga](id:182) → [](id:183)instead ofGenre: [Comic Book](id:182) → [Manga](id:183).Genre breadcrumb rendering
genere_id_cascade,sottogenere_id_cascade) when available. (genere_id/sottogenere_id vs. genere_id_cascade/sottogenere_id_cascade #286, btw)Regression coverage
Summary by CodeRabbit
Miglioramenti
Test