Feature summary
Since T326056: Show a warning on creating double redirect was resolved, when creating a double redirect, you are shown a warning when clicking publish. It would be useful if this same warning was also shown when previewing.
In fact, it would be useful if all relevant constraints were checked when previewing.
Some constraints are ⛔critical, because you can't save a page if a constraint is violated. Others are merely ⚠️advisory because they can display a warning that can be overridden.
Some of these constraints are not mutually exclusive, meaning that more than one constraint might be triggered by a particularly non-compliant page. If more than one constraint is violated, the response should note this. Critical constraints should also be prioritised over advisory constraints.
We think that the spam blacklist from Extension:SpamBlackList will also run if the "vanilla" spam checklist is also checked.
See also T396437: Edit constraints not checked when converting content model to wikitext, and T19467: Edit conflict notification on Preview/Show Changes (check for edit conflicts).
Notes
Edit constraints are located in includes / editpage / Constraint:
| Constraint Name | Summary | ⚠️Advisory/⛔Critical? | Should be checked on preview? | Status |
|---|---|---|---|---|
| AccidentalRecreationConstraint.php | Make sure user doesn't accidentally recreate a page deleted after they started editing. | ⚠️Advisory except if the user lacks the userrights required to create pages in that namespace, which makes it ⛔Critical. | ✅Yes - good idea | |
| AuthorizationConstraint.php | Verify authorization to edit the page (user rights, rate limits, blocks). | ⛔Critical | ❓Yes? But maybe not the rate limits though? If user is blocked, do they get another message? | |
| ChangeTagsConstraint.php | Verify user can add change tags. | ⛔Critical? | ❓Yes? | |
| ContentModelChangeConstraint.php | Verify user permissions if changing content model. | ⛔Critical? | ❓Maybe? Is this even possible with preview? | |
| DefaultTextConstraint.php | Don't save a new page if it's blank or if it's a MediaWiki: message with content equivalent to default. | ⚠️Advisory | ✅Yes - good idea | |
| EditFilterMergedContentHookConstraint.php | Verify EditFilterMergedContent hook. | ❓Unclear | ❓Maybe? What does this do? | |
| ExistingSectionEditConstraint.php | For existing-section edits, disallow certain auto summaries (which?) under specific conditions (which?). | ⚠️Advisory? | ✅Yes, probably | |
| ImageRedirectConstraint.php | Verify user permissions: If creating a redirect in the file namespace, must have upload rights. | ⛔Critical | ✅Yes - good idea | |
| LinkPurgeRateLimitConstraint.php | Verify that the user doesn't exceed linkpurge limits, which are unusual and special. | ⛔Critical? | ❓No? | |
| MissingCommentConstraint.php | Do not allow the user to post an empty comment (only used for new section). | ⚠️Advisory? | ✅Yes - good idea | |
| NewSectionMissingSubjectConstraint.php | For a new section, do not allow the user to post with an empty subject (section title) unless they explicitly choose to. | ⚠️Advisory? | ✅Yes - good idea | |
| PageSizeConstraint.php | Verify the page isn't larger than the maximum allowed size. | ⛔Critical | ✅Yes - good idea | |
| ReadOnlyConstraint.php | Verify the site is not in read-only mode. | ⛔Critical | ❓Maybe? Is another sitewide warning given? | |
| RedirectConstraint.php | Verify the page does not redirect to problematic or invalid targets. | ⚠️Advisory | ✅Yes - good idea | ✅Patched |
| SimpleAntiSpamConstraint.php | Verify simple anti-spam measure using an extra hidden text field. | ⛔Critical | ❓Maybe not? Does this need to be? | |
| SpamRegexConstraint.php | Verify summary and text do not match spam regexes. | ⛔Critical | ✅Yes - good idea | |
| UnicodeConstraint.php | Verify Unicode constraint (that the text is valid Unicode). | ⛔Critical | ✅Yes - good idea | |
But note the following are utility and interface files (not actual constraints):
| File Name | Summary | Role / Purpose | Status |
|---|---|---|---|
| EditConstraintFactory.php | Constructs and initializes constraint objects based on context. | Factory / Builder | Core utility |
| EditConstraintRunner.php | Handles execution and aggregation of all edit constraints. | Execution Manager | Core utility |
| IEditConstraint.php | Defines the interface that all constraints must implement. | Interface Definition | Interface |

