Commit graph

11322 commits

Author SHA1 Message Date
Ed Sanders
5a72d16766 mediawiki.router: Convert some instances of let to const.
Change-Id: I59c68476dbde9acd0e8223d07fecfd452d502a6c
2024-10-16 00:38:41 +00:00
Simon Legner
3acd948ed4 mediawiki.router: use this
Thanks to arrow-callbacks, we can use `this` directly.

Change-Id: I31c6280b2d80df8dd9b755d8d36c44f0f3e0f141
2024-10-15 23:42:45 +00:00
jenkins-bot
566b8c49db Merge "SpecialBlock, mediawiki.htmlform: remove OOUI/Codex conflicts" 2024-10-08 12:01:24 +00:00
jenkins-bot
3de08aa913 Merge "ExpiryField.vue: fix preselection of expiry field and add tests" 2024-10-08 06:07:07 +00:00
MusikAnimal
092aab36e5 SpecialBlock, mediawiki.htmlform: remove OOUI/Codex conflicts
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
2024-10-08 02:04:00 -04:00
MusikAnimal
8087bef18a ExpiryField.vue: fix preselection of expiry field and add tests
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
2024-10-08 00:31:36 -04:00
Gergő Tisza
58e5046bb2 signup: Fix AJAX username/password check
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
2024-10-07 19:11:44 +02:00
Ed Sanders
50cdd37868 eslint: Manually enforce prefer-const in all remaining code
Change-Id: Ic9f254b55d3936f351ba9c7cc3b553544fc63a58
2024-10-05 22:19:32 +00:00
Ed Sanders
2f3c89ac5d eslint: Manually enforce prefer-const on special page JS
Change-Id: Ia5d59fb9acb7e9b38696b61ea206ee7764ab9094
2024-10-05 22:19:24 +00:00
James D. Forrester
91a37f53b4 Switch over a bunch of class_alias uses to actuals
Change-Id: Id175a83e71cc910eaee5d5890a9106872a3ca3b8
2024-10-03 17:09:36 +00:00
jenkins-bot
f29acd320a Merge "mediawiki.special.block [Vue]: wrap all fields in an outer CdxField" 2024-10-03 08:19:36 +00:00
jenkins-bot
e2af266233 Merge "mediawiki.special.block [Vue]: add form validations and error states" 2024-10-03 06:48:50 +00:00
MusikAnimal
2f7624449a mediawiki.special.block [Vue]: wrap all fields in an outer CdxField
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
2024-10-03 01:27:15 +00:00
MusikAnimal
fff1b79cfb mediawiki.special.block [Vue]: add form validations and error states
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
2024-10-03 01:26:49 +00:00
Sam Wilson
6ab5ba5f52 Edit Recovery: wrap buttons if their text is long
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
2024-10-02 17:06:11 +00:00
jenkins-bot
cf0242232d Merge "Re-apply "Rename wgPageContentLanguage to wgPageViewLanguage"" 2024-10-02 16:09:42 +00:00
Fomafix
d1e854669b Re-apply "Rename wgPageContentLanguage to wgPageViewLanguage"
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
2024-10-02 15:31:33 +00:00
Volker E.
b060dff76e docs: Add a comment about Safari compatibility for the .hyphens mixin
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
2024-10-02 12:25:17 +02:00
jenkins-bot
8c01b98ae7 Merge "mediawiki.special.block: Set reblock in API call if already blocked" 2024-10-01 22:13:06 +00:00
Anne Tomasevich
0823ce884e Update Codex from v1.13.0 to v1.13.1
Bug: T322014
Bug: T362346
Bug: T373225
Bug: T375698
Bug: T376045
Change-Id: I48c5a0e781fb10893adf63921124df23587b83ad
2024-10-01 18:34:35 +00:00
jenkins-bot
753aaf6754 Merge "docs: Amend to valid skin variable name for width breakpoint" 2024-10-01 17:53:39 +00:00
Volker E.
e56051b83b docs: Amend to valid skin variable name for width breakpoint
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
2024-10-01 17:36:14 +02:00
jenkins-bot
e39f17565f Merge "mw-prefs-search-highlight: Use colour variable for outline as well as background" 2024-10-01 15:20:29 +00:00
TheresNoTime
6f7603edc6 mediawiki.special.block: Set reblock in API call if already blocked
Use `alreadyBlocked.value` to conditionally set `reblock` param
in API call.

Bug: T358934
Change-Id: Idf9deb35557d25714abb8af239c2c54a77b6cf7f
2024-10-01 14:52:10 +00:00
jenkins-bot
4fd15e4690 Merge "mediawiki.special.block [Vue]: surface server-side msgs + loading state" 2024-10-01 14:51:40 +00:00
jenkins-bot
a91bb14191 Merge "mediawiki.special.block [Vue]: fix form submission and add tests" 2024-10-01 14:08:56 +00:00
Ed Sanders
361b22830a mw-prefs-search-highlight: Use colour variable for outline as well as background
Follows-up If6569d4abae.

Bug: T376123
Change-Id: I2c5358ddb3ecad821d4f78d8a7366252fb595467
2024-10-01 14:30:23 +01:00
jenkins-bot
5f2ff833f9 Merge "SpecialBlock.vue: make 'already blocked' msg reactive" 2024-10-01 13:26:18 +00:00
Sam Wilson
3db5fd70a4 Edit recovery: Ask to recover, not to discard
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
2024-10-01 15:16:27 +08:00
MusikAnimal
60b74e9e1b mediawiki.special.block [Vue]: surface server-side msgs + loading state
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
2024-10-01 02:04:08 -04:00
jenkins-bot
8a4244e1a5 Merge "UserLookup.vue [Special:Block]: bind input-value and selected separately" 2024-09-30 19:19:37 +00:00
jenkins-bot
774660a662 Merge "Add a deprecation notice for mw.Uri" 2024-09-30 17:50:27 +00:00
MusikAnimal
3f010645b4 mediawiki.special.block [Vue]: fix form submission and add tests
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
2024-09-29 22:27:45 -04:00
MusikAnimal
718c55485c SpecialBlock.vue: make 'already blocked' msg reactive
And consequently, make submitButtonMessage a computed property.

Follow-Up: Iceaedbb1e3496c52b49a2b96d65445da45261b9f
Change-Id: I6774be041930135224493064e8a02dc39d10f67b
2024-09-29 21:57:29 -04:00
MusikAnimal
549f524dd0 UserLookup.vue [Special:Block]: bind input-value and selected separately
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
2024-09-29 21:57:29 -04:00
jenkins-bot
5dcf939aab Merge "mediawiki.special.block: read parameters from URL and preset form fields" 2024-09-28 03:02:42 +00:00
hmonroy
4d23e406d7 mediawiki.special.block: read parameters from URL and preset form fields
Preselect checkboxes if parameters have been defined in the URL.

Bug: T368583
Change-Id: Ib1c363cc629b035ed8a2b7c0585b67b6b826306f
2024-09-27 12:19:44 -07:00
Jon Robson
57372ca6b6 Message boxes: Drop unused CSS and fix page preview
* 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
2024-09-27 18:50:44 +00:00
Jon Robson
b9d8dd9745 mediawiki.util: Use appropriate Codex classes and attributes for Messages
* 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
2024-09-27 17:26:26 +00:00
jenkins-bot
9177a1ef7b Merge "Fix styling of message boxes on create account page, adds stable API" 2024-09-27 15:43:17 +00:00
Jon Robson
735dd6daf7 Fix styling of message boxes on create account page, adds stable API
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
2024-09-27 14:13:40 +00:00
jenkins-bot
dfd2ffb4cd Merge "apisandbox: Resize JSON/PHP data textbox when making a new request" 2024-09-26 13:36:07 +00:00
Ed Sanders
19c03834d0 apisandbox: Resize JSON/PHP data textbox when making a new request
Change-Id: I21c682f936678fb36e5bc74588152d82aee16898
2024-09-25 17:18:53 +01:00
jenkins-bot
bb67774ccd Merge "TargetActiveBlocks/TargetBlockLog: Populate table components with blocks" 2024-09-25 13:22:16 +00:00
TheresNoTime
f687a648a8 TargetActiveBlocks/TargetBlockLog: Populate table components with blocks
Add TargetActiveBlocks/TargetBlockLog tables to Special:Block.
Hide TargetActiveBlocks behind `blockEnableMultiblocks` flag.
Add util.js for common function(s)

Bug: T368062
Bug: T368111
Change-Id: Id4783c042cbf14a0de89a27f474cebbd102dff18
2024-09-25 13:06:11 +01:00
Máté Szabó
2a1ac5c854 createaccount: Add margin to temporary account notice
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
2024-09-25 00:37:02 +02:00
jenkins-bot
8143b783be Merge "mediawiki.special.block: make submit destructive and use old messages" 2024-09-23 21:35:47 +00:00
Ebrahim Byagowi
3ab92782e3 Add a deprecation notice for mw.Uri
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
2024-09-21 08:58:20 +00:00
jenkins-bot
60a26f7ccd Merge "Add Codex message box style module to pages that need it" 2024-09-20 17:22:32 +00:00
Jon Robson
7843fbc0c2 Add Codex message box style module to pages that need it
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
2024-09-20 16:53:36 +00:00