-
-
Notifications
You must be signed in to change notification settings - Fork 263
Feat: Enhancement to Cross-Language Orphaned FAQ Management #3908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This change introduces new functionality for managing FAQs that are not assigned to a category (orphaned FAQs). Previously, the view was restricted to the currently active backend language in both the list and the editor.
📝 WalkthroughWalkthroughRemoved per-language filtering for orphaned FAQs, added per-row deduplication and ordering by language+id, integrated a Twig language-code extension and fixed the orphaned-faqs template markup, added an optional faqLanguage constructor parameter to Category, and updated the FAQ controller to pass faqLanguage and allow POST on edit. Changes
Sequence Diagram(s)sequenceDiagram
actor Admin
participant OrphanedController as OrphanedFaqsController
participant TwigEnv as Twig Environment
participant FaqModel as Administration\\Faq
participant DB as Database
Admin->>OrphanedController: HTTP GET /admin/orphaned-faqs
OrphanedController->>TwigEnv: addExtension(AttributeExtension(LanguageCodeTwigExtension::class))
OrphanedController->>FaqModel: getOrphanedFaqs()
FaqModel->>DB: SELECT ... (no lang WHERE) ORDER BY fd.lang ASC, fd.id DESC
DB-->>FaqModel: rows
FaqModel-->>OrphanedController: deduplicated FAQ list (id+lang)
OrphanedController->>TwigEnv: render('orphaned-faqs.twig', {faqs})
TwigEnv-->>Admin: HTML (language cell resolved via language-code extension)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@phpmyfaq/src/phpMyFAQ/Administration/Faq.php`:
- Around line 243-266: When populating $data->languageName inside the loop that
processes DB rows (see the use of class_exists('\Locale') and
\Locale::getDisplayLanguage($row->lang, $currentBackendLang)), ensure you fall
back to the language code if getDisplayLanguage returns an empty string: call
\Locale::getDisplayLanguage(...) and if the result is empty or falsy, set
$data->languageName = $row->lang; otherwise use the display name; keep the
existing non-Locale branch unchanged.
In `@phpmyfaq/src/phpMyFAQ/Controller/Administration/FaqController.php`:
- Around line 249-258: The form that submits selectedRevisionId is POST but
FaqController::edit() only reads route attributes (request->attributes->get)
from a GET route, so $selectedRevisionId is never populated; fix by either
making the revision selector form use method="get" and read the value via
$request->query->get('selectedRevisionId') in edit(), or update the route that
maps to FaqController::edit to accept POST as well and read the submitted value
from $request->request->get('selectedRevisionId'); ensure the chosen approach
updates the form/method and the controller access (and tests) consistently so
$selectedRevisionId contains the submitted revision id.
This change introduces new functionality for managing FAQs that are not assigned to a category (orphaned FAQs). Previously, the view was restricted to the currently active backend language in both the list and the editor.
The adjustments made now enable full cross-language management:
Summary by CodeRabbit
Bug Fixes
New Features
✏️ Tip: You can customize this high-level summary in your review settings.