Skip to content

Allow admin to customize the Rules page intro text - #375

Merged
iMattPro merged 6 commits into
phpbb-extensions:masterfrom
iMattPro:updates
Aug 22, 2026
Merged

Allow admin to customize the Rules page intro text#375
iMattPro merged 6 commits into
phpbb-extensions:masterfrom
iMattPro:updates

Conversation

@iMattPro

Copy link
Copy Markdown
Contributor

No description provided.

@codecov-commenter

codecov-commenter commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.14815% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.80%. Comparing base (2f6a903) to head (a1789d6).

Files with missing lines Patch % Lines
controller/admin_controller.php 96.29% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #375      +/-   ##
============================================
- Coverage     99.89%   99.80%   -0.10%     
- Complexity      316      328      +12     
============================================
  Files            16       16              
  Lines           996     1045      +49     
============================================
+ Hits            995     1043      +48     
- Misses            1        2       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI 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.

Pull request overview

This PR adds a per-language, admin-editable introduction text for the Board Rules page, persisted in the rulesets table and rendered on the public rules page in place of the translated default intro when set.

Changes:

  • Adds rules_intro_text persistence and ruleset operator API for getting/setting the intro text per language.
  • Updates the public rules controller to render custom intro text (escaped + newline-to-<br> conversion) when present.
  • Extends the ACP “Manage rules” page with an intro editor (with placeholder fallback) plus tests and language strings.

Reviewed changes

Copilot reviewed 73 out of 73 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/operators/ruleset_operator_test.php Adds unit coverage for intro text defaulting, saving, and language validation.
tests/functional/boardrules_controller_test.php Verifies public rules page shows escaped intro with <br> conversion.
tests/functional/admin_controller_test.php Exercises ACP intro editor and DB persistence/encoding behavior.
tests/controller/main_controller_test.php Ensures the public controller assigns escaped intro text.
tests/controller/admin_controller_test.php Adds coverage for ACP fallback intro generation and intro-save behavior.
tests/acp/boardrules_module_test.php Verifies ACP module routes save_intro to the admin controller.
operators/ruleset.php Implements get_intro_text / set_intro_text and shared ruleset value persistence.
operators/ruleset_interface.php Extends the ruleset operator contract with intro getters/setters.
migrations/v30x/m18_ruleset_status.php Adds rules_intro_text column to the rulesets table schema (fresh installs only).
language/zh_cmn_hans/info_acp_boardrules.php Adds ACP log string for intro changes.
language/zh_cmn_hans/boardrules_acp.php Adds ACP UI strings for intro editing.
language/uk/info_acp_boardrules.php Adds ACP log string for intro changes.
language/uk/boardrules_acp.php Adds ACP UI strings for intro editing.
language/tr/info_acp_boardrules.php Adds ACP log string for intro changes.
language/tr/boardrules_acp.php Adds ACP UI strings for intro editing.
language/sv/info_acp_boardrules.php Adds ACP log string for intro changes.
language/sv/boardrules_acp.php Adds ACP UI strings for intro editing.
language/sk/info_acp_boardrules.php Adds ACP log string for intro changes.
language/sk/boardrules_acp.php Adds ACP UI strings for intro editing.
language/ru/info_acp_boardrules.php Adds ACP log string for intro changes.
language/ru/boardrules_acp.php Adds ACP UI strings for intro editing.
language/ro/info_acp_boardrules.php Adds ACP log string for intro changes.
language/ro/boardrules_acp.php Adds ACP UI strings for intro editing.
language/pt/info_acp_boardrules.php Adds ACP log string for intro changes.
language/pt/boardrules_acp.php Adds ACP UI strings for intro editing.
language/pt_preao/info_acp_boardrules.php Adds ACP log string for intro changes.
language/pt_preao/boardrules_acp.php Adds ACP UI strings for intro editing.
language/pt_br/info_acp_boardrules.php Adds ACP log string for intro changes.
language/pt_br/boardrules_acp.php Adds ACP UI strings for intro editing.
language/pl/info_acp_boardrules.php Adds ACP log string for intro changes.
language/pl/boardrules_acp.php Adds ACP UI strings for intro editing.
language/nl/info_acp_boardrules.php Adds ACP log string for intro changes.
language/nl/boardrules_acp.php Adds ACP UI strings for intro editing.
language/nb/info_acp_boardrules.php Adds ACP log string for intro changes.
language/nb/boardrules_acp.php Adds ACP UI strings for intro editing.
language/it/info_acp_boardrules.php Adds ACP log string for intro changes.
language/it/boardrules_acp.php Adds ACP UI strings for intro editing.
language/hu/info_acp_boardrules.php Adds ACP log string for intro changes.
language/hu/boardrules_acp.php Adds ACP UI strings for intro editing.
language/hr/info_acp_boardrules.php Adds ACP log string for intro changes.
language/hr/boardrules_acp.php Adds ACP UI strings for intro editing.
language/he/info_acp_boardrules.php Adds ACP log string for intro changes.
language/he/boardrules_acp.php Adds ACP UI strings for intro editing.
language/fr/info_acp_boardrules.php Adds ACP log string for intro changes.
language/fr/boardrules_acp.php Adds ACP UI strings for intro editing.
language/fi/info_acp_boardrules.php Adds ACP log string for intro changes.
language/fi/boardrules_acp.php Adds ACP UI strings for intro editing.
language/et/info_acp_boardrules.php Adds ACP log string for intro changes.
language/et/boardrules_acp.php Adds ACP UI strings for intro editing.
language/es/info_acp_boardrules.php Adds ACP log string for intro changes.
language/es/boardrules_acp.php Adds ACP UI strings for intro editing.
language/en/info_acp_boardrules.php Adds ACP log string for intro changes.
language/en/boardrules_acp.php Adds ACP UI strings for intro editing.
language/el/info_acp_boardrules.php Adds ACP log string for intro changes.
language/el/boardrules_acp.php Adds ACP UI strings for intro editing.
language/de/info_acp_boardrules.php Adds ACP log string for intro changes.
language/de/boardrules_acp.php Adds ACP UI strings for intro editing.
language/de_x_sie/info_acp_boardrules.php Adds ACP log string for intro changes.
language/de_x_sie/boardrules_acp.php Adds ACP UI strings for intro editing.
language/da/info_acp_boardrules.php Adds ACP log string for intro changes.
language/da/boardrules_acp.php Adds ACP UI strings for intro editing.
language/cs/info_acp_boardrules.php Adds ACP log string for intro changes.
language/cs/boardrules_acp.php Adds ACP UI strings for intro editing.
language/bg/info_acp_boardrules.php Adds ACP log string for intro changes.
language/bg/boardrules_acp.php Adds ACP UI strings for intro editing.
language/ar/info_acp_boardrules.php Adds ACP log string for intro changes.
language/ar/boardrules_acp.php Adds ACP UI strings for intro editing.
controller/main_controller.php Renders custom intro text on the public rules page when present.
controller/admin_interface.php Extends ACP controller interface with save_ruleset_intro().
controller/admin_controller.php Adds ACP intro editor plumbing, translated fallback generation, and save handler.
config/services.yml Injects @language.loader into the admin controller service.
adm/style/boardrules_manage_rules.html Adds the ACP intro editor form on the ruleset root.
acp/boardrules_module.php Routes new save_intro action to the admin controller.
Suppressed comments (2)

controller/admin_controller.php:357

  • save_ruleset_intro() checks check_form_key('boardrules_intro'), but (to avoid breaking other forms on the manage page) the intro form should share the existing add_edit_rule form key (or this method must be updated to match whatever key the template token is generated for). With the current code, either the intro form or the add/edit rule form will have an invalid token depending on which key is set last.
		if (!check_form_key('boardrules_intro'))
		{
			trigger_error($this->lang->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
		}

migrations/v30x/m18_ruleset_status.php:41

  • This migration only adds rules_intro_text when creating the boardrules_rulesets table. On upgrades where the table already exists (i.e., after m18_ruleset_status has run), effectively_installed() will prevent this migration from running again, so the new column will never be added and the new code will fail at runtime. A new follow-up migration is needed to add_columns for existing installations (while keeping this column in add_tables for fresh installs).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread controller/admin_controller.php Outdated
@iMattPro iMattPro changed the title Allow admin to customize the Rule spage intro text Allow admin to customize the Rules page intro text Aug 22, 2026
@iMattPro
iMattPro merged commit 4b60b6e into phpbb-extensions:master Aug 22, 2026
35 checks passed
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.

3 participants