Skip to content

Fix admin book genre hierarchy display#287

Open
Himura2la wants to merge 1 commit into
fabiodalez-dev:mainfrom
hackerembassy:fix-genre-display-issue
Open

Fix admin book genre hierarchy display#287
Himura2la wants to merge 1 commit into
fabiodalez-dev:mainfrom
hackerembassy:fix-genre-display-issue

Conversation

@Himura2la

@Himura2la Himura2la commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

The admin book detail page could render a root + direct-child genre as
Genre: [Comic Book](id:182) → [Manga](id:182) → [](id:183) instead of
Genre: [Comic Book](id:182) → [Manga](id:183).

image
  • Genre breadcrumb rendering

  • Regression coverage

    • Extends the existing root + child genre scenario to assert exactly two admin genre links with the expected IDs.

Summary by CodeRabbit

  • Miglioramenti

    • La sezione “Genere” nelle schede libro ora mostra informazioni più coerenti, normalizzate e senza duplicati.
    • I collegamenti a radice e sottogenere vengono visualizzati correttamente, anche quando sono presenti dati incompleti o non validi.
  • Test

    • Aggiunte verifiche sulla presenza e correttezza dei collegamenti ai filtri di genere nella scheda libro.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@Himura2la

Himura2la commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

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

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

La 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.

Changes

Visualizzazione dei generi

Layer / File(s) Summary
Normalizzazione e verifica dei generi
app/Views/libri/scheda_libro.php, tests/full-test.spec.js
Una closure valida, normalizza e deduplica radice, genere e sottogenere; il test verifica testo, conteggio e href dei link radice e sottogenere.

Estimated code review effort: 3 (Moderate) | ~15–30 minuti

Possibly related PRs

Suggested reviewers: fabiodalez-dev, fabiodalez

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Il titolo descrive correttamente la modifica principale: il rendering della gerarchia dei generi nella scheda libro admin.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between aae6353 and 8661692.

📒 Files selected for processing (2)
  • app/Views/libri/scheda_libro.php
  • tests/full-test.spec.js

Comment on lines +242 to +244
$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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants