Commit graph

151 commits

Author SHA1 Message Date
jenkins-bot
31f66267ae Merge "HTMLTitleTextField: Remove incorrect check for unsubmitted GET forms" 2019-09-20 22:45:24 +00:00
Daimona Eaytoy
290ab29617 Declare dynamic properties
This is for classes with a single undeclared property - aside from
BlockManager: I3f51fd3579514b83b567dfe20926df2f0930dc85 removed the
declaration of $permissionManager without actually removing all uses.

Change-Id: Ic2a95f77071312041be6e0633ea9b5325e98de42
2019-09-14 15:21:26 +02:00
Daimona Eaytoy
7862475b0d Improve various PHP method doc blocks
Follows-up 5eac6d131c.

Change-Id: I92c9d482fd8693a16b3967e763a4eb40b963c562
2019-09-05 18:45:40 +00:00
Daimona Eaytoy
b5cbb5ab3f Upgrade phan config to 0.7.1
This allows us to remove many suppressions for phan false positives.

Bug: T231636
Depends-On: I82a279e1f7b0fdefd3bb712e46c7d0665429d065
Change-Id: I5c251e9584a1ae9fb1577afcafb5001e0dcd41c7
2019-09-04 08:20:53 +00:00
Daimona Eaytoy
e70b5b3309 Unsuppress other phan issues (part 4)
Bug: T231636
Depends-On: I58e67c2b38389df874438deada4239510d21654f
Change-Id: I6e5fba7bd273219b1206559420b5bdb78734aa84
2019-08-31 17:13:39 +00:00
Daimona Eaytoy
5eac6d131c Unsuppress more phan issues (part 3)
Bug: T231636
Depends-On: I78354bf5f0c831108c8f606e50c87cf6bc00d8bd
Change-Id: I58e67c2b38389df874438deada4239510d21654f
2019-08-31 16:38:55 +00:00
Daimona Eaytoy
7f7efbe026 Globally unsuppress phan issues with low count
All of these suppression prevent the detection of many common mistakes,
and could easily prevent things like T231488. Especially if there are
few issues of a given type, it's way better to suppress them inline,
instead of disabling them for the whole core.
This patch only touches the one with a lower count (although those
counts may be out of date).

Bug: T231636
Change-Id: Ica50297ec7c71a81ba2204f9763499da925067bd
2019-08-30 09:40:47 +00:00
David Barratt
8a1f1ec631
Allow SelectWithInput to be marked as required and handle that dynamically
Alters the SelectWithInput to allow a required config to be passed from a
parent widget. Also handles the required state dynamically. If the widget is
an OR widget, then only the select dropdown is required. The text input will
be required when the other option is selected. If the widget is an AND widget
then both the select dropdown and the text input will be required.

Bug: T220533
Change-Id: I8479743126756f2b1bd7bcd53b100a0134f34d07
2019-07-30 16:33:02 -04:00
Thalia
ffcb5928e1 Allow empty input in namespaces multiselect on Special:Block
Follow-up to 83ebbb519f

Bug: T219882
Change-Id: I5f3d907a8f8be02f9e2c23d2a66c42752daa38b5
2019-07-18 17:04:26 +01:00
Thalia
83ebbb519f Check namespace exists in HTMLNamespacesMultiselectField validation
Bug: T219882
Change-Id: I710d0abed6bd40dcea5bdd1c59c8d936565961eb
2019-07-16 18:07:10 +01:00
jenkins-bot
5b202d729d Merge "Adjust type hints in htmlform related classes" 2019-07-05 21:32:55 +00:00
Umherirrender
11c9075767 Adjust type hints in htmlform related classes
The return type of HTMLFormField::loadDataFromRequest to mixed
Some sub classes returning arrays or bools, not everytime strings

HTMLCheckField is working with arrays, so also allow array on getTableRow

Change-Id: I076feea76d8e296f27c8a9fb4cbd9368584ba187
2019-07-05 18:11:53 +00:00
Derick Alangi
cb4b15786c htmlform: Reveal method getOOUI() is called from when spitting deprecation notice
Bug: T225683
Change-Id: I654b2d165feeb77394c214ae29bfaa7a9694b46d
2019-06-28 23:52:55 +00:00
Thalia
db9ff28e3e Fix some issues with HTMLSelectAndOtherField default and validation
Bring HTMLSelectAndOtherField in line with other HTMLFormFields by
ensuring that the default value is of the correct type and passes
validation checks.

Also make sure HTMLSelectAndOtherField::validate checks for the
final value, if the field has required set to true.

Bug: T222170
Bug: T225860
Change-Id: I949ee3df2b1f597982cf522b149c54b8e79d59bc
2019-06-15 10:34:36 +01:00
Derick Alangi
f97a7a93d4 htmlform: Use ::isValidRange() instead of deprecated ::isValidBlock()
Only 1 usage of this call in everywhere, see usage below. Once this is merged,
the method can be hard deprecated and later killed.

Usage
=====

https://codesearch.wmflabs.org/search/?q=%5CbisValidBlock%5Cb&i=nope&files=&repos=

Change-Id: Ic00f760a0a214faba7a71dd088da1dc25ecb796c
2019-05-09 16:36:05 +00:00
Bartosz Dziewoński
4d9a9f3776 HTMLFormFieldWithButton: Don't pass empty string as 'id'
The button must have an ID to be able to be infused. If the given ID
is null, that's fine, OOUI will generate one. But passing an empty
string apparently disables that.

Bug: T222013
Change-Id: I96e1f838385c5539ed246d2ee7107cd037a5f338
2019-04-30 02:10:16 +02:00
jenkins-bot
affd1dd473 Merge "HTMLFormFieldWithButton: Allow passing 'inputtype' and pass through 'buttonid'" 2019-04-12 20:22:58 +00:00
Ed Sanders
78431d4fba HTMLFormFieldWithButton: Allow passing 'inputtype' and pass through 'buttonid'
Change-Id: Ib1c94ac66caf6243631aa9d2b9f7fd2e6ca7a367
2019-04-11 17:40:47 +01:00
Bartosz Dziewoński
2d382b198f HTMLDateTimeField: Load styles for PHP widget
Bug: T220601
Change-Id: Id507459fea434bd6eb1af2bb6d1163c138a3a9d1
2019-04-11 00:50:11 +02:00
Kunal Mehta
8c98f51778 Fix PhanUnextractableAnnotation* errors (#7)
Change-Id: I8194a7b9c9abce951002590030913706e9bd743e
2019-04-05 23:20:07 -07:00
Reedy
c13fee87d4 Collapse some nested if statements
Change-Id: I9a97325d738d09370d29d35d5254bc0dadc57ff4
2019-04-04 19:02:22 +00:00
jenkins-bot
962b690e92 Merge "Use the WebRequest::getCheck() shortcut where possible" 2019-03-29 22:19:42 +00:00
Dayllan Maza
3b547150d8 Fix invalid namespace restriction when js is disabled
When JS is disabled on Special:Block you were able to specify
any namespace as part of the namespace restrictions field. This patch
rejects any virtual namespace submitted on that field

Bug: T216831
Change-Id: If09c43e5f836e1fdd9438b856d7f44f434c29fe1
2019-03-29 19:15:56 +00:00
jdlrobson
7a52d71e2a Use DateInputWidget for date inputs which do not need time
For those that still need the precision of time, the
DateTimeInputWidget can be used.

Bug: T107069
Change-Id: I2e0b0168b53594760c2630dc4ecd4e6af7404a7c
2019-03-27 21:59:10 +00:00
jenkins-bot
7b88a72136 Merge "Fix the order of the parameters for htmlform-title-badnamespace" 2019-03-11 20:28:07 +00:00
Thiemo Kreuz
a2c1d8c043 Use the WebRequest::getCheck() shortcut where possible
This is inspired by Ib117e05.

As far as I can tell this is functionally identical. Even arrays should
behave the same, as both the getVal() and getCheck() methods do have a
special case that returns the `null` default in case the user tried to
pass multiple values instead of a single scalar.

Change-Id: Id4e4ec91f39d3c39461bd41673bdafc3bde11737
2019-03-11 09:50:52 +01:00
mainframe98
301973d1af Fix the order of the parameters for htmlform-title-badnamespace
The name of the page is the first parameter, and the namespace is
the second parameter.

Change-Id: I738cdd920d0ce641837c5dc1da391602a15df794
2019-03-09 17:00:26 +01:00
Max Semenik
61c539126f Convert a few call_user_func*() calls to native PHP syntax
Change-Id: I54d94f4369eb4fa0b0ebe892a1d6cc57b2bdb1f9
2019-03-07 19:25:40 -08:00
Thiemo Kreuz
30b05e1072 Replace lowercase {@inheritdoc} with @inheritDoc
According to the coding standards we even enforce with a custom PHPCS sniff.
It currently does not pick these mistakes up because of the curly brackets.
I'm not sure if this is worth an update of the PHPCS sniff. I wanted to
suggest this fix anyway.

Change-Id: I9041ea7a00baf7f55e0ff0e56879a89fb74bb479
2019-03-01 17:25:02 +00:00
Moriel Schottlender
a7fd92a95e mw.widgets.TitleWidget: Add 'excludeDynamicNamespaces' config
Allow excluding all pages that are in dynamic (negative) namespaces.

Bug: T208355
Change-Id: I9b39f66ac828bc0c100a2fc347b365f75672efb1
2019-02-14 17:26:03 -08:00
Kunal Mehta
cc5d9a92a2 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: I66b1775b7c1d36076d9ca78cbeb42787a743f2aa
2019-02-07 18:39:42 +00:00
jenkins-bot
c1436805cd Merge "Introduce multiselect widgets for namespaces" 2019-01-23 17:02:41 +00:00
Thalia
ccbe9f3590 Introduce multiselect widgets for namespaces
Bug: T204986
Change-Id: Ie3916e2322d8b1a7effe9ba4604b596b568004e6
2019-01-22 12:48:42 +00:00
SamanthaNguyen
870831d40c htmlform: Move HTMLSelectLanguageField into includes/htmlform/fields
This was originally directly under includes/htmlform. This is
a specific type of field, so it should go here instead.

Follows-up d0c31ac988.

Change-Id: Iac196068ce2cbca063948bc78d21913482717d9a
2019-01-22 04:56:44 +00:00
Thalia
1d442c19cf Fix TitlesMultiselectWidget documentation
Change-Id: I4b6bad233b4a4dfd840385f26a10bd190f6cb6b9
2018-12-10 18:28:14 +00:00
Alangi Derick
f6fcb74728 htmlform: Fix multiple PHPDoc annotations in htmlform module
- Add @param annotation for $params variable for __construct() method
  in the HTMLExpiryField class.
- Add @throws annotation for getOptionsOOUI() method that throws a
  MWException and remove "@return array" as this method only throw an
  exception now.

Change-Id: I292f6ae04b840f6f6f74b7c92f834f056659fbe2
2018-12-03 12:48:53 +00:00
Volker E
ed42e2fae2 HTMLCheckMatrix/CheckMatrixWidget: Adding th to thead
Improving semantics, which also reflects in screen readers.

Change-Id: I552a61a6e1892ebed86d9434366bd932f6f7a602
2018-11-16 15:27:19 -08:00
Thalia
a61d51af9e TitlesMultiSelectWidget: pass through 'input' config
Also set 'autocomplete' to false in the 'input' config
in Special:Block.

Bug: T208551
Change-Id: I0376e4ce809aeb48496530cdd5d39ac9142c28bd
2018-11-13 19:29:04 +00:00
Thalia
8fec7ed09a TitlesMultiselectWidget: rename 'limit' config to 'tagLimit'
To avoid conflicting with TitleWidget config.

Bug: T209057
Change-Id: Ia0dbc49f38a116202eb2658b7556fb7f0627f1bb
2018-11-13 19:29:04 +00:00
Thalia
61a6a0445b TitlesMultiselectWidget: pass through additional configs
Pass through 'limit' and 'showMissing' configs.

Also set 'showMissing' to false for partial blocks.

Bug: T208626
Bug: T208627
Change-Id: Ifa75e2d390bf349226ad69d68adcdcaf742ab560
2018-11-13 19:28:54 +00:00
jenkins-bot
ecee5cd7c7 Merge "Use PHP 7 '??' operator instead of if-then-else" 2018-10-24 21:58:04 +00:00
jenkins-bot
13dba84b6f Merge "Fix PHPDoc type for instance variables and methods" 2018-10-24 21:17:02 +00:00
Moriel Schottlender
07a5c71646 TitlesMultiselectWidget: Add a widget that allows selection of multiple titles
Add the widget in both PHP and JS for OOUI, and into HTMLForm
definitions.

In JS, the widget uses the engine from mw.widgets.TitleWidget
with the async support from OO.ui.mixin.RequestManager.

The PHP version provides a textarea, like UsersMultiselectWidget.php
which is then infused if JS is available.

Also, add highlightSearchQuery option for TitleWidget to allow for
not highlighting the partial search query the user typed in, if the
UI requires it. This option (highlighting partial result) is already
optional in the TitleOptionWidget, so this config exposes that
optionality in the TitleWidget widget for its menu children.

Notes:

HTMLTitlesMultiselectField is a duplication of HTMLUsersMultiselectField
except for:
- The configuration variable changed to 'titles' (from 'users')
- OOUI modules were adjusted for the TitlesMultiselectWidget
- The PHP version instantiates a MediaWiki\Widget\TitlesMultiselectWidget

TitlesMultiselectWidget is a duplication of UsersMultiselectWidget
except for:
- $usersArray was renamed to $titlesArray
- getJavascriptClassName returns the correct js class for
  mw.widgets.TitlesMultiselectWidget for infusion.

Bug: T197109
Depends-On: I675316dddf272fd0d6172ecad3882160752bf780
Change-Id: Ie96947a35f70b76731e16ae5b85de815dfa4a8ce
2018-10-24 00:46:48 +00:00
Fomafix
43244db9a2 Use PHP 7 '??' operator instead of if-then-else
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
2018-10-21 21:46:46 +02:00
Alangi Derick
b4ecf374fe Fix PHPDoc type for instance variables and methods
Should be "string" not "String" and "array" not "Array" in
@param, @return and @var use cases. Also, minor typo fixes.

Change-Id: I9d5ebc5b741c6560907b95f7c0c4039da2861f4a
2018-10-21 13:00:25 +01:00
jenkins-bot
3d98b80a39 Merge "Add OOUI for HTMLFormFieldCloner" 2018-10-12 22:30:59 +00:00
Bartosz Dziewoński
c9b599abab HTMLInfoField: Undo breaking change, deprecate instead, add release notes
Follow-up to e6eb87ae20.

Bug: T203202
Bug: T205956
Change-Id: I2d19d376d218c59e4ea36e8635e883afac2adea6
2018-10-11 02:06:48 +02:00
mainframe98
8b48c99889 Add OOUI for HTMLFormFieldCloner
The JavaScript for the cloner fields has been updated to function
when using OOUI Cloners.

The buttons are packed quite tight together, but there does not
seem to be any CSS that enforced the spacing that I could find.

Bug: T171666
Change-Id: Iba6eed9d6cee922d56855bbe2e836956bfd90f42
2018-10-02 11:50:10 +02:00
jenkins-bot
8df18bbd13 Merge "HTMLInfoField: Support 'rawrow' in OOUI mode" 2018-09-30 18:18:26 +00:00
jenkins-bot
1dee28cb5f Merge "Simplify HTMLTitleTextField::validate" 2018-09-26 13:19:49 +00:00