Instruct Special:Block to only load OOUI and the old JS module
when we're not using Codex.
Fix six year-old bug (from I20d11d7cc4) in mediawiki.htmlform's
selectandother.js where OOUI was incorrectly being assumed, causing
'Widget not found' errors at Special:Block when $wgUseCodexSpecialBlock
is true.
Bug: T358934
Change-Id: Ia959d297ac9043804975f170eec66ddd4c1fe492
With this change, the ?wpExpiry query param and the interface message
[[MediaWiki:Ipb-default-expiry]] accept only the following formats:
* /\d+ [a-z]+s?/ – such as "1 month", "2 weeks", etc.
* infinity values: 'infinite', 'indefinite', 'infinity', 'never'
* ISO 8601-like datestamp
In addition, [[MediaWiki:Ipboptions]] now requires an option be preset
with the value 'infinite'.
Rename `blockDefaultExpiry` to `blockExpiryDefault` for consistency.
Bug: T368583
Change-Id: Ibc648117e6d4981c84e9df9f933ba033d339e908
Fix form error display logic, doubly broken in If864607cbece8992:
it used too much array dereferencing in the error.length === 1 case
so only the first character of the string was shown, and it passed
a HTML string to messageBox() which expects a DOM node or plain
text. (Ideally, there would be some mechanism similar to
OO.ui.HtmlSnippet that allows passing HTML, but that's left for the
future.)
Also deduplicate the error formatting logic.
Bug: T376428
Change-Id: I053b4bd0cf3d6a0962540a90ae7f6b25129362a4
This simplifies handling of the disabled state, allowing Codex to
automatically propagate it to child components.
Messages are left hard-coded (instead of using the `messages` prop) for
more control over display, and to accommodate multiple errors.
Bug: T358934
Change-Id: If652bc38a91e3741c680c9e5a1825d546eb287ee
We leverage the native browser validations for most fields (i.e.
`required` attribute on TextInputs). After form submission,
the user is brought to the erroneous field and given browser-provided
validation messages, displayed using Codex.
Browser validation may later be upstreamed to Codex (T373872), after
which we won't need ValidatingTextInput, or the custom handling in
UserLookup.
ExpiryField was written prior to CdxRadio supporting a custom-input
slot. Rework the CdxRadios in ExpiryField to use the new slot, and
apply `status` and `messages` to the nested CdxField instead of the
entire ExpiryField, so that validation states are applied only to the
invalid elements.
For now, there is only one other custom validation that cannot be
provided by the browser: requiring a selection for "Preset duration".
Validation logic is contained within ExpiryField, but since this field
doesn't effect `checkValidity()`, we need to check the expiry value in
SpecialBlock.vue on form submission. This is necessary since we don't to
show error states when the component is first mounted.
Also make tests a bit more DRY by adding a new `getSpecialBlock()`
method to the setup file.
Bug: T369471
Change-Id: Iff340e8747329678b80ca00c768fabec2c194320
Add flex-wrap:wrap to the buttons in the edit recovery notification,
to avoid internal text wrapping when not required.
Change-Id: I69fb0655a879060cb24b26fd81c58e2371408cf1
Follow-Up: I05e53f302a80a9ad8223d4d2cacf2ca5fca6cc65
Bug: T364664
The value of wgPageContentLanguage was changed to "page view language"
rather than "page content language" in 44725333f.
The naming is confusing and should be renamed to wgPageViewLanguage.
This change reverts d2aa7d5949.
Bug: T303375
Change-Id: Ibe0ed6ec2a7fe042482564970e05d360b89841fe
Adding a comment about minimum Safari and iOS compatibility for
`.hyphens()` Less mixin in order to emphasize when we can get rid of
vendor property and mixin as a whole.
Change-Id: Ibd6605454c459ad988407d9be3f5b6950ef81231
We only offer `min-width-*` and `max-width-*` skin variables for
breakpoints nowadays for better developer experience.
Following up Ie397cf6839.
Bug: T349793
Change-Id: Id647b8fb8917072cbcd27988c20b992e20e8aa61
Change the edit recovery prompt to ask before recovering the
saved data, instead of recovering and then asking whether to
revert the recovery.
Also change the button's to the shorter text, and so remove the
need to have them on separate lines.
Bug: T364664
Change-Id: I05e53f302a80a9ad8223d4d2cacf2ca5fca6cc65
This adds a new message box for successful messages, and reworks the old
one to handle all error messages.
Error messages are inline for now (like the old Special:Block). Note
these are only the server-side messages, that chiefly serve as a
fallback for clientside error states which will be tackled in a future
patch.
A loading state is added for the block API request by simply disabling
the form fields. Once completed, the user is scrolled to the top to view
the appropriate messaging. This uses "smooth" scrolling so that it's a
bit less "in your face", but this is subject to design review. For now,
it's just important the user is brought to the approriate error message.
Other changes:
* Add a bit of left margin to the inline error message, consistent with
the no-JS version of this page. Without this, things "jump" a bit as
the Vue applicaton loads. More refinements for this to come later.
* Fix styles for .mw-block-partial-options to be exactly the same as
Codex labels.
* Remove unnecessary IIFE from init.js, and add a class to the form
so we can style it closer to the designs.
Bug: T369471
Bug: T358934
Change-Id: I47344e9581439289642c9424a5f229929805cdbe
Add a blockType v-model to BlockTypeField, and use that to determine if
we are placing a partial or sitewide block. Also set the default to be
'sitewide'.
Give ExpiryField datetime input the form name `wpExpiry-other` to match
current Special:Block.
Introduce mockMwApiGet() to the test suite which provides mocks for the
known API calls, and warns about those that aren't. Additional mocks or
overrides can be provided per-test as needed. This system hopefully will
help make the Jest suite more robust with realistic data to work with.
Bug: T358934
Change-Id: I5e1baaeb4dc9ae8ef9fcb44513b1c6a675eb94d1
And consequently, make submitButtonMessage a computed property.
Follow-Up: Iceaedbb1e3496c52b49a2b96d65445da45261b9f
Change-Id: I6774be041930135224493064e8a02dc39d10f67b
Other changes:
* Emit update:modelValue so the parent component has the new value
* Abort any pending API requests when user input changes
* Adjust test to use the more appropriate flushPromises() instead of
nextTick(), and utilize beforeAll() hook.
Follow-Up: Iceaedbb1e3496c52b49a2b96d65445da45261b9f
Change-Id: I943767f8814134c1d53a34e3bcb883c0e982d782
* mw-ui-vform-field is no longer used in practice - the only consumer
in core was the account creation form but that's now Codex. The
message box markup is no longer supported so we can just remove
this code.
* mediawiki.hlist is only used in Minerva and Collection extension
and neither puts a message box in the message, so this old markup
can be removed.
* Fix display of messages in the live preview feature
Bug: T375287
Change-Id: I623c2798a7ecbb32a20d2a4235ee9143b2da8b33
* Add support for inline messages and default to ARIA live region
set to polite
* Add missing cdx-message class
Follow up to If864607cbece899222afba57ca4bfe2f72f9dcfe
Bug: T375902
Change-Id: I7a5c2689a4fe17de4990446c744a2d576fe4db62
The stable API mw.util.messageBox is added. This matches the existing
Html::messageBox method and provides a stable way to render messages
on the client going forward. Since these are often used by gadgets
and in extensions this seems like a good idea to allow us to easily
change the HTML in future without breaking things and to detect usage
more easily.
Bug: T375519
Change-Id: If864607cbece899222afba57ca4bfe2f72f9dcfe
Why:
- The notice box shown to temporary users on the signup page has no
bottom margin.
- This makes the form unsightly if it has validation errors, as there's
no spacing between the notice and the validation error boxes.
What:
- Add a small bottom margin to the notice box.
Bug: T375550
Change-Id: If80e8ed83be936ed6052146cbe4c4f214f5a0c7b
Most of the purposed changes to replace mw.Uri to URL has went smoothly
so maybe we can consider this now so at least no new uses would be added
to it.
Bug: T374314
Change-Id: I532e893b817fe760f0f45883187d4f29edf47b69
Since legacy skins do not load the full version of Codex, many
Codex message box appeared unstyled on pages which call
functions using Html::messageBox
Legacy skins do not load Codex by default, so these should be
explicitly added by the interface using them. Since there are
lots of these, for now we'll do this in the skin to avoid
breakage.
For skins supplying Codex via other style modules,
this will be negligible because of gzip, they will also be
able to remove the style if necessary.
Bug: T373602
Bug: T375246
Change-Id: If3c2d26de3faa9f85025ea8643d97242cad27574