Commit graph

2095 commits

Author SHA1 Message Date
MusikAnimal
5fcc50be82 SpecialBlock [Vue]: add NamespacesField and PagesField components
These use the new CdxMultiselectLookup component.

Values for the two inputs can be pre-filled with the
'wpPageRestrictions' and 'wpNamespaceRestrictions' URL parameters.

Tests to be added in a future patch (along with other tests around
partial blocks).

Bug: T362718
Bug: T362912
Bug: T368583
Change-Id: I53739bcdd63870fbfb57bc96298fc8d467bdfc2b
2024-10-16 18:39:36 -04:00
MusikAnimal
fa8dea7798 SpecialBlock [Vue]: require confirmation for hidehuser and self blocks
Special:Block is supposed to show a 'Confirm block' checkbox under two
conditions: if the 'hide username' option is being used, or if the user
is blocking themselves.

This patch takes the SPA-like behaviour a step further and will disable
the submit button and show the confirmation checkbox if the user target
is changed to the current user, or if the 'Hide username' checkbox is
checked. The logic of hiding the confirm checkbox and re-enabling the
submit button should follow the same rules.

Add `withSubmission()` helper to SpecialBlock.test.js and add test cases
for the newly added code.

Bug: T376754
Change-Id: Ie990051ae62b11f3a27bbc4cfc5c714a0096e2f3
2024-10-16 17:30:05 -04:00
MusikAnimal
b5fcc80af0 SpecialBlock [Vue]: add Pinia store for state management
Add a 'block' Pinia store to house all block-related data use in the
SpecialBlock.vue application. Minimal refactoring is done to make use of
the store, rather than passing around props.

UserLookup is reworked to only update the store's targetUser property on
a 'change' event, since the Codex Lookup component wants a "selection"
while we want to allow arbitrary input. This means anything that listens
to changes to the targetUser isn't fired off too quickly (i.e. API
requests, or flashing error states).

Other changes:

* Remove 'disabled' attribute from ExpiryField as the disabled state is
  applied automatically.
* Change SpecialBlock.test.js to test against a date that's not a mere
  decade away.

Bug: T376741
Depends-On: Ia88d987bf7e5afa1a17d63b4ebc96448ccec2f6c
Change-Id: Id6cff21eeeeb86876e59f70994ad10658ab6d9be
2024-10-16 17:30:04 -04:00
hslater
3ec3ff8d42 Add ARIA labels for the table of contents toggle button
Added "Show the table of contents" ARIA label for the button when the TOC is hidden.
Added "Hide the table of contents" ARIA label for the button when the TOC is displayed.

Bug: T336098
Change-Id: I922dc12287c241d6937acad0d9ec12eccc439014
2024-10-15 21:46:46 +13:00
TheresNoTime
e3c25ad3ee mediawiki.special.block: Clarify "no reason given"
Set a distinct style on the "no reason given" message
Set `aria-label` to clarifying message for screen readers

Bug: T376746
Change-Id: I7d0f73ff7031f9d08f488a580681ccc8b7c3d93c
2024-10-10 14:06:09 +01:00
TheresNoTime
c41eae4b17 mediawiki.special.block: Add "See full log" link
Add a "See full log" link to TargetBlockLog
Add Jest test to TargetBlockLog

Bug: T376742
Change-Id: Ibf1ef088c23fa67c1710ea037cc5838977113007
2024-10-10 12:27:41 +01:00
TheresNoTime
816baee019 mediawiki.special.block: Modify TargetBlockLog behaviour
Remove the "target" column
Add a column "type" with fields "Blocked"/"Unblocked"
Add Jest test for TargetBlockLog

Bug: T368111
Change-Id: I3e9145df62046baaa3fe762a6f57c932a976508c
2024-10-10 11:47:45 +01: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
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
jenkins-bot
4fd15e4690 Merge "mediawiki.special.block [Vue]: surface server-side msgs + loading state" 2024-10-01 14:51:40 +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
774660a662 Merge "Add a deprecation notice for mw.Uri" 2024-09-30 17:50:27 +00: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
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
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
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
MusikAnimal
de2b3f7a59 mediawiki.special.block: make submit destructive and use old messages
SpecialBlock calls HTMLForm::setSubmitDestructive(). This patch applies
that to the new Vue version of Special:Block.

Additionally, since we're not going to enable multiblocks in the initial
launch, the submit button message is changed to as it was before. "Save
block" is questionable even for multiblocks. It will likely be a while
before we iron out the UI for multiblocks, so we might as well remove
now-unused 'block-save' message.

The "[username] is already blocked" message is now also surfaced, i.e.
browsing to [[Special:Block/someblockuser]]. Like the old Special:Block,
changes to the block target field won't re-query to see if the user is
already blocked (though that would be a fine improvement). However
*unlike* the old Special:Block, such changes do make the message
disappear.

Bug: T373572
Change-Id: Iceaedbb1e3496c52b49a2b96d65445da45261b9f
2024-09-18 20:43:22 -04:00
Jon Robson
a09791e942 Support legacy message boxes in user generated content
* Deprecate SkinModule feature 'interface-message-box"
* Include styles using dedicated module where needed for content.

Bug: T375127
Depends-On: I58d9e41f0c98adbd816240b161b5145a667436cd
Change-Id: I59ab5f222dc9d01de04077d3e2cef5b42a8ffe08
2024-09-18 21:02:59 +00:00
jenkins-bot
621614fab2 Merge "mediawiki.special.block: add reason field" 2024-09-17 01:18:28 +00:00
Ebrahim Byagowi
e5f5d7cc29 Reduce uses of mediawiki.Uri in mediawiki.rcfilters
This doesn't touch UriProcessor of the module that has become a wrapper
around mw.Uri but just simpler uses of mw.Uri which could be replaced
before that.

Bug: T374314
Change-Id: Ic60fdd56f38bd438ba7f005cc1b220b279a26cf9
2024-09-13 08:33:01 +03:30
Ebrahim Byagowi
50d9e8030b Replace mw.Uri with native URL in mediawiki.ForeignApi.core
Bug: T374314
Change-Id: I2e0f819d473444ffa413cd10056d126dd352739e
2024-09-13 03:22:25 +02:00
hmonroy
2d1a3660e3 mediawiki.special.block: add reason field
Add Html::listDropdownOptionsCodex() that takes a bulleted list like
[[MediaWiki:Ipbreason-dropdown]] and adapts the data struture for use
with a Codex Select component.

Currently optgroups are not supported (T367241) so we show the optgroup
labels as disabled options instead.

URL query string parameters do not yet prefill any fields. This will be
tackled as part of T368583.

Bug: T362912
Change-Id: Ib89dcf35ca2a1cd74404c42f5411d7c095b98952
2024-09-11 21:14:25 -04:00
jenkins-bot
52791dc19a Merge "mediawiki.special.block [vue]: add new ExpiryField to enter block expiry" 2024-09-10 00:43:22 +00:00
Ebrahim Byagowi
f6ce7cd66b Replace mw.Uri with browser provided URL object in two places
So mediawiki.Uri dependency of the modules can be dropped.

Bug: T374314
Change-Id: Ic9d7f1654e31c2c25365a71fb79d87aeeda7ff11
2024-09-09 20:22:58 +03:30
jenkins-bot
06b1522184 Merge "OOUI: Provide the 'editing-functions' icon pack module" 2024-09-06 16:21:43 +00:00
MusikAnimal
0f95e00e61 mediawiki.special.block [vue]: add new ExpiryField to enter block expiry
This uses a new three-part form to allow the features of manually typing
an expiry (i.e. "31 hours") but allowing to do so for non-English users,
who previously didn't have this capability unless it was set in
MediaWiki:Ipboptions. The ability to use MediaWiki:Ipb-default-expiry to
set a default expiry is still supported, assuming it is either a valid
option in MediaWiki:Ipboptions or in the new "Custom duration" field
(i.e. "31 hours"). See https://w.wiki/B65S for more, though this
functionality doesn't appear to be used anywhere on the WMF cluster.

"Expiration" is renamed in the code to "Expiry" to match the naming of
other MW components (ExpiryDef), but the user-facing message is still
"Expiration".

No validation is done yet, but will be added in a future patch.
Similarly, pre-supplying values via URL params is saved for T368583.

Bug: T359684
Change-Id: Iffb6fa3f539d29ed25802a19f4c13c627208259c
2024-09-03 21:24:56 -04:00
Ebrahim Byagowi
c3624faf59 Turn mediawiki.action.view.metadata to Less
And use user-select mixin

Change-Id: If27339e595a510cd0d5c84fb9dd4a8c2d3048a2a
2024-09-03 13:39:41 +03:30
James D. Forrester
9698ed95a2 OOUI: Provide the 'editing-functions' icon pack module
This will be needed by the Wikifunctions VisualEditor integration.

Change-Id: I622d9a5ef61678bb4cc9b1d9309c6ee8540f97ce
2024-08-30 12:29:18 -04:00
MusikAnimal
24de971e00 SpecialBlock: refactor to use $useCodex class property
Resources: alphabetize i18n key list

Change-Id: I4bed4f1bb2cba46b7330c6a4ee9a1b323dc6adc2
2024-08-29 04:21:48 +00:00
Ebrahim Byagowi
33c8f3cce2 Remove deprecated since 1.41 '@vue/composition-api' module
Deprecated since Iaf7bd2986b7f4185923969899d61878e5ee5905b
and no longer it seems used in Wikimedia codebase or gadgets in
Wikidata or Wikimedia Commons, there was one userscript
in English Wikipedia (not a gadget and was in User: namespace),
which I notified them they can just use Vue module.

Change-Id: I0a45d97866519765be5c3bdff9c0a20b003f78ae
2024-08-27 08:38:08 +03:30
jenkins-bot
1b1a1b75ba Merge "Remove deprecated 'mediawiki.pager.tablePager' module" 2024-08-25 21:39:21 +00:00
jenkins-bot
87da1dda4b Merge "Remove deprecated mediawiki.icon module" 2024-08-25 21:29:59 +00:00
Ebrahim Byagowi
299240b008 Remove deprecated mediawiki.icon module
Bug: T351681
Change-Id: I99430c708b006436c600550dd661602c6aeccf3f
2024-08-25 23:56:31 +03:30
Ebrahim Byagowi
0c8ef42c4e Remove deprecated 'mediawiki.pager.tablePager' module
Deprecated since 1.38 in favor of the more generic
`mediawiki.pager.styles`.

Change-Id: Ie85cc47e3ac3020449ca6370d727017ae3f0daaf
2024-08-25 23:53:37 +03:30
jenkins-bot
6cee73b752 Merge "Remove use of moment.js in Special:EditRecovery" 2024-08-25 12:21:58 +00:00
jenkins-bot
42113daef5 Merge "Allow change tags to have help links in separate messages" 2024-08-23 17:36:57 +00:00
Ebrahim Byagowi
72f17ff700 Remove use of moment.js in Special:EditRecovery
Replace the use with browser toLocaleString

Bug: T146798
Change-Id: I30364c1677461a7875329d0127e39779f1c52afa
2024-08-19 06:19:37 +03:30
jenkins-bot
3141c4d542 Merge "Use Less in jquery.suggestions" 2024-08-18 11:19:24 +00:00
Ebrahim Byagowi
3457defa9e Use Less in jquery.suggestions
Change-Id: Ifaddd8496236775964dee26df810dee2a9d770a3
2024-08-17 21:22:57 +03:30
Ebrahim Byagowi
379f290053 Use Less in jquery.confirmable
Change-Id: I043c804744d1dd7be886a32cd90144b314dc1e49
2024-08-17 21:07:51 +03:30
Ebrahim Byagowi
ae0a4206bf Remove use of a deprecated module from collapsibleFooter
This removes the use of deprecated mediawiki.icon module from
mediawiki.action.edit.collapsibleFooter, the only use of
the module in MediaWiki core.

It also adds a small animation for the toggle icon.

Bug: T351681
Change-Id: Ie22ef2a91a57116a6a2deff7a8d938db294ee40c
2024-08-15 10:13:34 +03:30
Bartosz Dziewoński
7bab3cd60e Allow change tags to have help links in separate messages
Many changes tags added by extensions include links in the 'tag-<tag>'
label messages, which point to help pages for the tags and the software
features that add them. This makes translating the labels unpleasant.

Introduce localisation messages like 'tag-<tag>-helppage' (following
the pattern of 'tag-<tag>-description'), which should contain a URL
or a page title of a help page for the given tag. When such link
message is defined, the tag description in changes lists, history
pages etc. is wrapped in a link that points to the given URL or page.

Unlike the label messages, the link messages are always used in wiki
content language, for easy on-wiki customization. For compatibility
with old translations and existing on-wiki overrides, if 'tag-<tag>'
already contains any links, 'tag-<tag>-helppage' is ignored.

Add buttons that allow editing the new links on Special:Tags. Correct
existing buttons that allow editing the labels to use user language.

Add help links using the new messages to the changes list filtering
interface (which can't display links in tag descriptions themselves).

Introduce a link message for 'mw-contentmodelchange' tag as an example.

Bug: T372175
Change-Id: I1e2242a8591597a110a5a430f4c251f0f601cfbe
2024-08-13 22:26:16 +02:00
Reedy
b52a8addf5 Drop writeapi userright
Bug: T294397
Depends-On: Ib34228a18917e404517d45e539bd786419d9c401
Change-Id: Ifad2edc782b36d21c8c67fecde7f011dce02c11b
2024-07-31 11:10:50 +00:00
Ebrahim Byagowi
e469e79fd4 Turn mw.widgets.MediaSearchWidget to LESS
Change-Id: I03b26af0ee9b425a7d6b17bfda7bf61f5aacc657
2024-07-09 15:38:45 +03:30
jenkins-bot
8465c74fc0 Merge "Turn mediawiki.widgets.Table styles from CSS to LESS" 2024-07-08 22:49:31 +00:00
Ebrahim Byagowi
423d222ea5 Turn mediawiki.widgets.Table styles from CSS to LESS
They have repetition of selectors which can be improved using LESS.

Change-Id: I78971a0040c8986b71b0cec5044a489fd18fb8b2
2024-07-08 22:17:23 +03:30
Ebrahim Byagowi
9d93e4faf5 Turn mw.widgets.SelectWithInputWidget.base from CSS to LESS
The repeated selectors the file has benefits from LESS.

Change-Id: Ie374e46434f423666321f9251d027e522c3b2604
2024-07-08 21:45:57 +03:30
jenkins-bot
5892a10274 Merge "Convert mw.widgets.SizeFilterWidget.base.css to less" 2024-07-08 18:00:12 +00:00