Commit graph

9097 commits

Author SHA1 Message Date
Dreamy Jazz
2b19a410f0 Reject temporary account usernames on Special:PasswordReset
Why:
* Special:PasswordReset allows users to send an email containing
  a temporary password to the email address attached to an account.
* Temporary accounts do not have passwords and cannot have an email
  address set (as they cannot access Special:Preferences).
* Therefore, Special:PasswordReset does not provide holders of
  temporary accounts a way to get access back into the temporary
  account if they loose access.
* However, the form currently accepts temporary account usernames
  and we should update the functionality to reject such usernames.

What:
* Update SpecialPasswordReset to reject temporary account usernames.
* Expand tests for SpecialPasswordReset to check this fix has worked.

Bug: T380085
Change-Id: I004453d4d16cd2a0448ac3922e4d13c24a158c8d
(cherry picked from commit e27be818690820c0df227cb06206da499eb94d38)
2024-11-18 14:35:28 +00:00
Umherirrender
e9d784aec5 specials: Do not allow transclusion of Special:DeletedContributions
The special page is not public accessible and
is not allowed to transclused in wikitext.

In 077e3057ff the special page extends ContributionsSpecialPage that
extends IncludableSpecialPage and makes this includable.

Bug: T378727
Follow-Up: Ica817be5c5e078b88c9b3157b54d0dbf997e8893
Change-Id: I34a557e28d288d56679b1c99f8607597207ed14a
(cherry picked from commit 523de9ec3be373feb2a8b5e65eb3a1d554e73d44)
2024-10-31 20:08:49 +00:00
Taavi Väänänen
bf3d07d236 SpecialRenameUser: Fix warning display
Bug: T378259
Change-Id: I135d3370824081e481376cd3010c257ba73e8378
(cherry picked from commit 3da57081e1bd17d7ed6c1996af33d0b5cf5592af)
2024-10-28 23:49:27 +00:00
Ammarpad
04c707bcba specials: Do not pass boolean to Message::numParams
Password policy settings 'value' can be a number, boolean or a null

But only number needs to be passed to the corresponding policy
messages (to be output). Boolean and null represent the message
assertion and are not output in the eventual message string (the
messages do not have parameter).

Values with false and null are already skipped, so this change only
affects values with boolean true.

Bug: T378133
Change-Id: Ib9e6f7ed14f9982f9d2350ccd7b212f0fbf10477
(cherry picked from commit 41a9230775c569833911cb3cdb41c651013df04c)
2024-10-26 23:13:14 +00:00
Abijeet
31dd3925fd SpecialWhatLinksHere: Ensure namespace variable is defined
Broken in I313b595ccbcf0650fceffc5bfd31bc245aca0237

Bug: T378048
Change-Id: I09b753fb642d877b3d49fe13c204a16298b9725d
2024-10-24 05:55:43 +00:00
Ammarpad
d1a5b2ca04 specials: Avoid passing null to str_replace()
Do null-coalescing at call site since the function already
expects these arguments to be strings

Bug: T377916
Change-Id: I1bf57646b5a4ef03d49d178e0e75d4e61cf90c00
(cherry picked from commit 6f5777fe5ab48e4b3bf25ebd2dcc9ebf0e2d1fa6)
2024-10-23 16:19:25 +00:00
jenkins-bot
5c1f66bf58 Merge "WhatLinksHere: Allow extensible filters" 2024-10-22 07:52:25 +00:00
jenkins-bot
ec3dbb1046 Merge "SpecialWhatLinksHere: Replace FormOptions with request data in an array" 2024-10-22 07:47:08 +00:00
Umherirrender
1b29f07440 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
2024-10-21 20:41:20 +02:00
jenkins-bot
cd7a5998e9 Merge "Make Message and MessageValue compatible" 2024-10-21 15:38:56 +00:00
Huei Tan
ba14f43365 WhatLinksHere: Allow extensible filters
Add SpecialWhatLinksHereQueryHook hook that allow extensions
to modify the query builder to add more conditions based on
the filters added in the SpecialPageBeforeFormDisplay hook.

Bug: T216368
Change-Id: I221d4e0ad671feab6937719d4a2f894ad6154bb1
2024-10-21 14:27:53 +05:30
Abijeet
b48aa58858 SpecialWhatLinksHere: Replace FormOptions with request data in an array
Replace FormOptions with array based form data instead of FormOptions
and specify defaults when defining HTML form fields. We prefer using
form data since values for HTML fields added via
SpecialPageBeforeFormDisplay hook are available in this array but not
in FormOptions.

When extensions add fields to this page via
SpecialPageBeforeFormDisplay or ActionModifyFormFields hook, they can
access the value of the added field via the form data using new hook to
perform custom filtering.

Bug: T216368
Change-Id: I313b595ccbcf0650fceffc5bfd31bc245aca0237
2024-10-21 14:27:53 +05:30
jenkins-bot
1d79c173cf Merge "SpecialBlock [Vue]: add NamespacesField and PagesField components" 2024-10-21 01:53:28 +00:00
Doğu Abaris
3be65fb3cc License: Use typed properties
- Replaced class properties with typed properties.
- Updated `$template` to `string`.
- Updated `$text` to `string`.
- Removed redundant type comments.

Change-Id: I53ff765949b8df978b189bd63306ed380a75c912
2024-10-19 15:46:09 +00:00
Doğu Abaris
c93f0d1ee2 Licenses: Use typed properties
- Replaced class properties with typed properties.
- Updated `$msg` to `string`.
- Updated `$lines` to `array`.
- Updated `$html` to `string`.
- Updated `$selected` to `?string` (nullable).
- Removed redundant type comments.

Change-Id: Iebfeda2a29d41cde0a0d7559757075973228bfa1
2024-10-19 13:04:13 +00:00
Bartosz Dziewoński
9d56257d8c Make Message and MessageValue compatible
Fix two problems that made it difficult to convert between Message
and MessageValue, or to write code that could accept both of them,
as exemplified by the StatusValue class:

* Implement a common interface
* Use the same internal format for message parameters

While these changes should be compatible with most of existing code,
where the authors were courteous enough to simply call methods such
as Message::numParam() and not look inside the values they return,
it is potentially a breaking change for anything that depended on
the formatted params being arrays or accessed their keys.
Example patches: https://gerrit.wikimedia.org/r/q/topic:message-param

Notable changes:

* Message and MessageValue now both implement MessageSpecifier
  (only Message implemented it before).

* Message::numParam() and other static methods for encoding params
  now return MessageParam objects, instead of special arrays.
  Use these MessageParam objects internally in Message.

* Narrow down the return type of MessageSpecifier::getParams() (it
  was just `array`, allowing any type in the array). Narrow down the
  types for Message::params() and MessageValue::params() to match.

* Deprecate MediaWiki\Message\Converter. As a replacement add
  MessageValue::newFromSpecifier(), which is analogous to
  Message::newFromSpecifier(), but without weird legacy edge cases.

* Make StatusValue::getMessages() return MessageValues. Remove code
  that converted between Message and MessageValue, no longer needed.

* Update many type declarations and comments to use MessageSpecifier
  instead of MessageValue, as well as a couple of tests that depended
  on implementation details.

Bug: T358779
Change-Id: I625a48a6ecd3fad5c2ed76b23343a0fef91e1b83
2024-10-19 15:00:07 +02:00
Doğu Abaris
2d93f534e8 Use typed properties in Contribute classes and add GPL license header
- Added GNU GPL license header to ContributeCard, ContributeCardAction,
  ContributeCardActionLink, ContributeFactory, and ContributeCardsHook
- Use typed properties in ContributeCard and ContributeCardAction
- Removed redundant docs for properties now using typed declarations

Change-Id: Ifb962f15fd08b2415e6877502b90db4ad1bdfcbe
2024-10-19 14:37:58 +02:00
jenkins-bot
f5b16d4868 Merge "Deprecate OutputPage::{get,set}PreventClickjacking()" 2024-10-18 12:13:15 +00:00
MusikAnimal
f0ba9bfc06 SpecialBlock [Codex]: fix presetting of relative and infinity wpExpiry
Jest tests don't cover PHP bugs :-P

Before, passing in the URL param wpExpiry as '3 days' or 'infinity'
wouldn't parse. Now it does. Add tests for reinforcement. The assertions
against `$fields[ 'EditingRestriction' ]` aren't that important and have
been removed to make use of the data provider easier.

Bug: T368583
Follow-Up: Ibc648117e6d4981c84e9df9f933ba033d339e908
Change-Id: I8070c90a535cac8715dcdf588c62aab14861a2fc
2024-10-18 04:58:19 +00:00
C. Scott Ananian
d6d6343c68 Deprecate OutputPage::{get,set}PreventClickjacking()
This is redundant with the same-named methods on ParserOutput.

Bug: T301020
Change-Id: I60455186e3a6e9b4329ff09e2f7ea920e2e05192
2024-10-17 23:51:39 -04:00
jenkins-bot
5b7fdde90d Merge "SpecialBlock [Vue]: require confirmation for hidehuser and self blocks" 2024-10-17 21:58:17 +00:00
jenkins-bot
abc8da60be Merge "Use explicit nullable type on parameter arguments" 2024-10-16 23:10:14 +00:00
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
Umherirrender
e662614f95 Use explicit nullable type on parameter arguments
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead

Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a

Break one long line in SpecialPage.php

Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
2024-10-16 20:58:33 +02:00
James D. Forrester
e7db78e8d6 Replace uses of deprecated ChangeTags static methods
Bug: T360664
Change-Id: I3363a225e54bb2cae01ba066d432a8b7b21933d2
2024-10-16 13:30:12 -04:00
James D. Forrester
a5387c7c20 Namespace all remaining classes in includes/parser
Bug: T353458
Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
2024-10-15 23:54:32 +01:00
jenkins-bot
83e3436cdd Merge "SpecialPasswordReset: Minor cleanup" 2024-10-14 10:58:57 +00:00
jenkins-bot
4e30474a7c Merge "SpecialBlock: Hard-deprecate deprecated functions" 2024-10-10 18:14:16 +00:00
jenkins-bot
081d9e7ee4 Merge "mediawiki.special.block: Preset remaining URL parameters" 2024-10-10 17:18:06 +00:00
Reedy
d879283865 SpecialPasswordReset: Minor cleanup
* Remove private $method that was never read
* Swap private $result to local variable
* Doc and comment tweaks

Change-Id: Ief100be748aac3537d5c1db8720e543ffd3e1995
2024-10-10 17:27:51 +01:00
Fomafix
3f1e249b00 SpecialBlock: Hard-deprecate deprecated functions
processForm, parseExpiryInput and canBlockEmail are deprecated since
1.36.
getSuggestedDurations is deprecated since 1.42.

Depends-On: I5931525f95ff6eb76a2b30aa7a852cc86075276f
Depends-On: I6a570e503fee6676e7c54beb6f37575058a57339
Depends-On: I6890763dbe30cc33b2715e93c59cee331d8967b1
Depends-On: I99f49dd3f20032848cc7a191a6b46c5816f3bff2
Change-Id: Ibbf51d9de168d97c0ed3c827f02a356c8a579987
2024-10-10 15:52:57 +00:00
jenkins-bot
3bf2b6a23f Merge "WebRequest: Add PHP return type hint for getRawVal" 2024-10-10 15:05:43 +00:00
jenkins-bot
dbe8c4b9aa Merge "WebRequest: Deprecate parameter $default in getRawVal" 2024-10-10 15:05:35 +00:00
Fomafix
7be5a303d1 WebRequest: Add PHP return type hint for getRawVal
Improve the code to avoid phan errors detected by this type hint.

Change-Id: I134d962e1cf95f6b135f3e8959669dc41ccec877
2024-10-10 14:01:26 +00:00
jenkins-bot
ae3afe014b Merge "Remove meaningless @var documentation from constants" 2024-10-09 22:03:23 +00:00
jenkins-bot
6c56577575 Merge "Use content dir in DoubleRedirects and ShortPages special pages" 2024-10-09 18:03:32 +00:00
hmonroy
0d1fbcb2dc mediawiki.special.block: Preset remaining URL parameters
Add wpEditingRestriction, wpReason, wpReason-other, wpHideName to
parameters that are allowed in the URL.

Bug: T368583
Change-Id: Ibf08eb8b4e44383407dbf4f9a30ef86a2b317276
2024-10-09 10:38:47 -07:00
thiemowmde
b1c9ec74fa Remove meaningless @var documentation from constants
A constant is not a variable. The type is hard-coded via the value
and can never change. While the extra @var probably doesn't hurt much,
it's redundant and error-prone and can't provide any additional
information.

Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
2024-10-09 09:33:12 +02:00
MusikAnimal
d94a438c06 SpecialBlock: re-add enableOOUI, prevents prod error
We *do* need to call `$this->getOutput()->enableOOUI()` because the
Widget class still relies on it. This happens when there are errors
(`SpecialBlock::preErrors`), for example when attempting to block
yourself.

Bug: T358934
Follow-Up: Ia959d297ac9043804975f170eec66ddd4c1fe492
Change-Id: Ie7918726a074188e34a833a38a07f9639afdb571
2024-10-08 20:56:32 +00:00
jenkins-bot
a725ca8a7f Merge "SpecialBlock: don't pass blank expiry to wfTimestamp" 2024-10-08 18:16:22 +00:00
jenkins-bot
566b8c49db Merge "SpecialBlock, mediawiki.htmlform: remove OOUI/Codex conflicts" 2024-10-08 12:01:24 +00:00
Ebrahim Byagowi
90f03e77bb Use content dir in DoubleRedirects and ShortPages special pages
Whenever possible content dir should be used for titles coming
from contents of a wiki rather than the user language UI.

And now that we are here let's set lang attribute also as the
links are in the content language while rest of the special
page uses user language, that can be useful for better font
rendering and so.

Bug: T375975
Change-Id: Icff7338ecd7b9686a596f5192b2d6666a32263da
2024-10-08 09:05:56 +00:00
MusikAnimal
22bc655a1a SpecialBlock: don't pass blank expiry to wfTimestamp
Without this, providing no wpExpiry in the URL means you get the current
datetime :-P

Bug: T368583
Follow-Up: Ibc648117e6d4981c84e9df9f933ba033d339e908
Change-Id: I809af2f5ee82aad2e85bfee7499bfadee870312e
2024-10-08 03:20:30 -04: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
jenkins-bot
581ecc235c Merge "Use getContentLanguage() in two special pages instead of injection" 2024-10-05 17:40:23 +00:00
jenkins-bot
b2c04d154c Merge "Wrap category links around <bdi>" 2024-10-05 17:32:30 +00:00
Ebrahim Byagowi
b7ce4a4341 Use getContentLanguage() in two special pages instead of injection
Change-Id: I24aab0ee13353bb29eb5fbb3d68ebc9389d5321f
2024-10-05 20:08:43 +03:30