Repository navigation
Validate "Excluded topic IDs" and let the field be cleared - #220
Merged
Merged
Conversation
The ACP saved rt_anti_topics only when every comma-separated entry was numeric, and otherwise dropped the input while still reporting "Configuration updated". An empty field never saved either: explode() gives [''], which is not numeric, so the list could not be cleared. normalise_anti_topics() trims entries, drops empty ones and duplicates, and turns an empty list into '0' (exclude nothing). Any entry that is not a whole number makes the ACP show RT_ANTI_TOPICS_INVALID and save nothing; the check runs before any setting is written. The new language key is translated in all 14 packs. Closes #217 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #217.
Problem (raised in the customisations team's 3.0.11 review)
rt_anti_topicsonly when every comma-separated entry was numeric. Otherwise it silently kept the old value but still showed "Configuration updated".explode(',', '')gives[''], which isn't numeric, so the list couldn't be cleared (the workaround was0).Fix (
acp/recenttopics_module.php)normalise_anti_topics(): trims entries, drops empty ones (a trailing comma, a blank field) and duplicates, and turns an empty list into'0'(exclude nothing). It returnsnullif any entry isn't a whole number.main()runs the check right after the form-key check, before any setting is written. Invalid input shows the newRT_ANTI_TOPICS_INVALIDerror and nothing is saved.RT_ANTI_TOPICS_INVALIDis translated in all 14 ACP language packs.Tests
tests/acp/anti_topics_test.php: 11 inputs, from valid lists, spacing, duplicates, a trailing comma and an empty field to text, decimals and negatives. All errored before the helper existed.0.tests/tests.mdupdated. Unit suite: 101 tests, 0 failures, run locally. CI result to follow.0is what the topic query already treats as "exclude nothing".This folds into 3.0.12; its changelog line comes with the 3.0.12 changelog update.
🤖 Generated with Claude Code