Commit graph

56 commits

Author SHA1 Message Date
Aryeh Gregor
3860a8d9b4 Update DefaultPreferencesFactory to use NamespaceInfo
Depends-On: I552264714de7227965f978f20f932f41cf96042e
Change-Id: I0568e7f4c7223208001f378a03fef395df8bff69
2019-05-06 12:19:13 +03:00
Aryeh Gregor
18ec468633 Don't pass Config to service constructors
We don't want to depend on the entire site configuration when we only
need a few specific settings.

This change additionally means that these services no longer see a live
version of the settings, but rather a copy. This means in tests you
really do have to call overrideMwServices() if you want services to pick
up your config changes.

ResourceLoader and SearchEngineConfig will need more work to port,
because they expose their member Config in a getter, and the getter is
actually used.

Parser and NamespaceInfo are also relatively complicated, so I split
them into separate patches.

Tested with 100% code coverage. \o/

Depends-On: If6534b18f6657ec1aba7327463f2661037f995b3
Change-Id: I1a3f358e8659b49de4502dc8216ecb6f35f4e02a
2019-05-02 11:33:56 +03:00
Reedy
571a44a4be Replace PreferencesFormLegacy usages with PreferencesFormOOUI
Change-Id: I4fc2a609ebb0f93b0767dddc343c3ff93ca8a39c
2019-04-14 00:51:05 +00:00
Fomafix
14d9e80ba4 Fix order of @var parameter in PHP
Replace

 @var $foo type

by

 @var type $foo

Change-Id: Iec8b90ffea4028a1005daef422b7c4ec38c2715f
2019-04-08 18:37:56 +02:00
Max Semenik
e6818e6c64 Fix unused vars/pointless assignments
Change-Id: If475c738b4af7208024c866594d4c0048af053dd
2019-03-29 16:52:48 -07:00
Tim Eulitz
8736acada9 Remove temporary rollback confirmation toggle
This patch removes the temporary rollback confirmation toggle that was
implemented to allow certain wikis to disable the rollback confirmation
feature while still showing the option in the user preferences.

For reference:

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/494249

Bug: T217437
Change-Id: I001d7927f6f44a4cc517a80b71f5b83aca33824c
2019-03-26 10:13:45 +01:00
Tim Eulitz
c4e5364ea0 Implement temporary rollback confirmation toggle
This change implements a temporary feature toggle for the rollback
confirmation change. The main purpose is to allow users of certain wikis
(de-wiki, pl-wiki, for example) to turn off this upcoming feature before
it is released to production.

Bug: T217039
Change-Id: I6ed59afde5b75756053da3ae46858304dda9317d
2019-03-21 14:21:13 +01:00
tzhelyazkova
aca802509e Add a user preference to opt in or out of a confirmation prompt for rollbacks.
Bug: T199537
Change-Id: I2f08ef5f8c38f23b282e130d040681fc060b6b00
2019-03-21 09:05:27 +01:00
Tim Eulitz
07c0c40978 Remove rollback confirmation user preference
Due to a delay in the rollout of this feature, this part of the code has
to be temporarily removed again to prevent an unused setting from
popping up in the user settings.

Bug: T218556
Change-Id: I0f4e822fc25fddc2bc3c0b55b0792799a1e4c4ba
2019-03-19 13:49:51 +00:00
jenkins-bot
43a0144346 Merge "Add a user preference to opt in or out of a confirmation prompt for rollbacks." 2019-03-14 13:17:47 +00:00
tzhelyazkova
9c4d596dbc Add a user preference to opt in or out of a confirmation prompt for rollbacks.
This should not be visible on production until the feature of rollback confirmation prompt has been deployed.

Bug: T199537

Change-Id: I8a49143f662b8412f74c06627c2285ab3c3b8cff
2019-03-06 16:44:09 +01:00
James D. Forrester
3f717984c1 Drop AuthPlugin and related code, deprecated in 1.27
Bug: T215843
Depends-On: Ie49709faa6f67b0a31bd546823d29dbfea0a70eb
Depends-On: If8109dbfdeeb88a6265f4cd79d1ae81bff48d934
Depends-On: I36b195fa2d6c23a76631ebaf869c787e44427d60
Depends-On: Iaa171b085fde331eab7d85c7de74523e27fc625a
Change-Id: I330b30d6582034a233fed204c0680b1ce84eec6e
2019-03-05 08:23:14 +00:00
jenkins-bot
6daa17a2a0 Merge "Remove comments literally repeating the next line of code" 2019-03-01 02:37:27 +00:00
Fomafix
1e5af82d2d Preferences: Remove href="#" from stub threshold sample link
* Prevents the sample link from being focusable and selectable via
  keyboard navigation.
* Prevents the sample link from being clicked, which would switch
  to the first preferences tab and scroll to the top, unhelpfully.
* Since 4f8967672d an <a> without an href also has cursor:pointer on
  hover.

Change-Id: I679e277d17dc679177c29d557806c9a9e91c6703
2019-02-28 14:00:38 +00:00
Thiemo Kreuz
37b3383e8b Remove comments literally repeating the next line of code
I would argue that these comments do not add any information that
would not be there already. Having them adds mental overhead, because
one needs to read both the comment and the next line of code first to
understand they say the exact same. I don't find this helpful, but
more distracting.

Change-Id: I39c98f25225947ebffdcc2fd8f0243e7a6c070d7
2019-02-27 17:28:40 +00:00
Krinkle
4b275c60de Revert "Pass $context to 'GetPreferences' hook"
This reverts commit d685694594.

Change-Id: I1e9299b8fdc4727895fdac60f04cc5dfa4d09b7a
2018-12-10 02:58:59 +00:00
Volker E
293a1391de Special:Preferences: Add example value as placeholder to timezone offset
Adding example value as placeholder message in timezone offset input.

Bug: T194524
Change-Id: I1fd6183233109355e49b7baecf44a8603c1efdb2
2018-11-27 15:03:02 -08:00
jenkins-bot
0f2447023d Merge "Update wording for RC and Watchlist UI opt-out option" 2018-11-21 16:41:46 +00:00
Kosta Harlan
89cce717d5 Update wording for RC and Watchlist UI opt-out option
Bug: T207741
Change-Id: I8d6795f5e39fa5bceabd2da5e6a5b43d009a3bab
2018-11-19 23:56:12 +00:00
Bartosz Dziewoński
f526b30305 Special:Preferences: Split up "Advanced options" on watchlist and RC tabs
On Special:Preferences, in the "Watchlist" and "Recent changes" tabs,
there is currently an "Advanced options" section, which contains a
huge list of mostly unrelated checkboxes.

Split off some of them that are actually related to two new sections,
"Watched pages" and "Changes shown", to make it easier to understand
their purpose.

Change-Id: I9bf91b78f6af49214a5d467d0896c63eb376d3d2
2018-11-14 12:52:43 +00:00
jenkins-bot
a63c458127 Merge "Pass $context to 'GetPreferences' hook" 2018-11-01 04:00:23 +00:00
C. Scott Ananian
97d9659904 Replace deprecated calls to OutputPage::parseInline()
Every one of these seemed to previously use the wrong value for
`$interface` -- the interface messages in ProtectionForm and
SpecialVersion were being parsed as content language (which is the
default for `OutputPage::parseInline`), and the one place where we
have actual data in the content language (the user signature, which
gets parsed in the content language with the rest of the (talk) page
content, see Parser.php::pstPass2) was being parsed as an interface
message!

Forcing the caller to be very explicit about AsContent() or AsInterface()
will help mitigate this in the future, one hopes.

Bug: T198214
Change-Id: Ib9d5d8d733a47c967bdf7db3e23fa39f11687063
2018-10-29 15:34:43 -04:00
jenkins-bot
ecee5cd7c7 Merge "Use PHP 7 '??' operator instead of if-then-else" 2018-10-24 21:58:04 +00:00
Bartosz Dziewoński
d685694594 Pass $context to 'GetPreferences' hook
Users of the hook no longer have to rely on global context to display
localisation messages.

Change-Id: Ic4006c9d175031f45ee9e38eddc2879e3d1b79c2
2018-10-24 23:03:42 +02:00
James D. Forrester
9c32d7bcf4 Follow-up cfa70ea6d0: Fix rebase artefact, also remove preference listing
Change-Id: Ia146f013beba2c82a8f76355b49a4192fbd0ed3b
2018-10-24 07:58:47 -07:00
Fomafix
43244db9a2 Use PHP 7 '??' operator instead of if-then-else
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
2018-10-21 21:46:46 +02:00
James D. Forrester
dcf3eb793a Special:Preferences: Drop non-OOUI legacy form version
Change-Id: I65b89385c3ec28ef01b86dd933dae3801e503631
2018-10-01 17:47:02 -07:00
Stephane Bisson
2e8512c7d0 Remove temporary rcfilters variables
wgStructuredChangeFiltersShowPreference, wgStructuredChangeFiltersShowWatchlistPreference,
and wgStructuredChangeFiltersOnWatchlist were introduced for progressive rollout
of the RCFilters app on RC and WL.

These variables and their related conditional code is no longer needed.

Bug: T196033
Change-Id: Id3799fefd21cd9bea0e089a5e12576ee9ea1085e
2018-09-27 13:39:05 -04:00
Brian Wolff
a89ef9b3b9 Fix some double escaping, and some incorrect escaping for convert()
convert() is weird and requires things to be escaped before it
is called.

This fixes a bunch of phan-taint-check warnings.

Change-Id: I422b313ca05ff61ae05e06856347cc0de832cc49
2018-09-21 17:27:44 -07:00
Kosta Harlan
b3c9551790 Set consistent min value options for RC and Watchlist filters
Bug: T204623
Bug: T199049
Change-Id: If73b7cf6734f4a6a8d8e47ce8051a827ae5452e1
2018-09-21 15:21:00 -04:00
Kosta Harlan
89dcdfa826 Watchlist preferences: Disallow zero value for days/limit
"0" used to work as an undocumented shortcut for "maximum allowed" days/edits,
but this behavior was removed in If6280ad6fbad65909e1d0b2a48344e24d485aca2

This commit brings the preference options into alignment with how the code
functions.

Bug: T199049
Bug: T176033
Change-Id: I5ffd87565df6b3c602d1f69d9d63621a817ce8cf
2018-09-06 13:17:06 -04:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Max Semenik
e6b4944dbf Introduce preference filters
This normalizes handling of transformations on the boundaries between
preferences and generic form controls and removes the special case
where email-blacklist is passed around as an array internally, leaking
into the API.

As a result of this normalization, meta=userinfo no longer returns an
array of users, using the internal representation like action=options.

Bug: T198935
Change-Id: Iff63da0d215585cfcf083e7f7ec8ed45d5b77301
2018-07-17 13:19:14 -07:00
Fomafix
88f469624d Use $lang->hasVariants() instead of count( $lang->getVariants() ) > 1
Change-Id: I23668c69a8d8cc886168cbbd4f94cf13b597b5a6
2018-07-11 16:13:17 +00:00
Bartosz Dziewoński
b41930486f Avoid duplicate IDs on Special:Preferences
The value of the 'section' parameter is used to generate some ID
attributes on Special:Preferences. Awkwardly, only the second part
(after the slash) is used, so have to ensure these are unique.

It is also used for the default localisation message for the title of
the section. Override this so that we don't have to rename and
duplicate the messages.

Bug: T198875
Change-Id: I0f22aafc8b2ad860dd42c5373eafdf88e848e3ad
2018-07-05 20:38:09 +02:00
Moriel Schottlender
232deffd81 RCFilters: Preserve collapsed state and adjust display
When collapsed, make sure we are adjusting the 'min-height' on the
'rcfilters-head' div so that it actually takes the space it should.

Make sure the preference of whether the area is collapsed or not is
preserved for the user, per RC or WL pages, and that it is loaded
properly with the correct minimum height dimensions depending on
which state is in the preferences, so to prevent "jump" of the
result list after load.

Bug: T177206
Change-Id: I82c3042cd1bb85dedcd6b5458b157fed94def808
2018-06-20 11:12:00 -07:00
Fomafix
aad2e5c38b Preferences: Allow only languages with translations in user options
This change allows only language codes with translations for the user
option 'language'. This restrict the selectable values in the
preferences and also prevents setting the user option via API.

With the URL parameter 'uselang' the user interface language can
still set to a language code without translation.

In the current situation this change will remove the following language
codes from the allowed values:
> print '* ' . implode( "\n* ", array_diff(
	array_keys( Language::fetchLanguageNames( null, 'mw' ) ),
	array_keys( Language::fetchLanguageNames( null, 'mwfile' ) )
) );
* aa
* als
* bat-smg
* be-x-old
* cho
* fiu-vro
* ho
* hz
* kj
* kr
* mh
* mus
* ng
* no
* rn
* roa-rup
* shi-latn
* shi-tfng
* simple
* tum
* uz-cyrl
* uz-latn
* zh-classical
* zh-min-nan
* zh-yue

The change I1dd6fb1f240ce3319b132d0f29f0622fba33e655 ensures that the
deprecated language codes get replaced by the new language codes. The
other untranslated language codes get replaced by the content language
codes when the user loads the preferences.

Bug: T118199
Change-Id: I1382996b031af3fe9f6e1568beeb6376dcbcd217
2018-06-14 13:32:47 +00:00
jenkins-bot
7793c8acc6 Merge "RCFilters: Add an opt-out preference for filters on watchlist" 2018-06-05 01:39:50 +00:00
Bartosz Dziewoński
03583f7a91 Use PHP 7 "\u{NNNN}" Unicode codepoint escapes in string literals (part 2)
This is a follow-up to Idc3dee3a7fb5ebfaef395754d8859b18f1f8769a
containing some less trivial changes.

Change-Id: Ia7af2c1d000307d43278cde4a246df413d4ef263
2018-06-04 16:40:48 +00:00
Roan Kattouw
5b2dd85524 RCFilters: Add an opt-out preference for filters on watchlist
And a temporary feature flag so we can roll it out in stages.

Bug: T195431
Change-Id: I170840146a197ac381df94434350ae2f0561d147
2018-05-31 17:24:28 +00:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
jenkins-bot
402dd3cd82 Merge "preferences: Preserve Status from saveFormData() in submitForm()" 2018-05-30 19:24:43 +00:00
Reedy
6b6c71558e Fix PreferencesForm alias
Change-Id: I6f24c6283b4165b9209e53f8fc3b8ecb5feb9ca4
2018-05-29 21:44:18 +00:00
Bartosz Dziewoński
c513ec19ef Restore 'PreferencesForm' as alias for 'PreferencesFormLegacy'
In change 4633f4d46a it was changed
to an interface implemented by both PreferencesFormLegacy and
PreferencesFormOOUI so that existing typehints for some functions
parameter would accept them both. Replace those typehints to use
HTMLForm instead. There was really no guarantee in the past that
they would only be given PreferencesForm or its subclasses, either.

Because the typehint change affects some hooks, note it as a
deprecation in MW 1.31 and a breaking change in MW 1.32.

Also add @since tags and correct some typos in code comments.

Follow-up to 4633f4d46a.

Change-Id: I61749f1d864cf68afe90cd9e15ba2d7a74252501
2018-05-24 21:20:50 +00:00
Alexia E. Smith
7b2182d9e5 preferences: Preserve Status from saveFormData() in submitForm()
The old Preference::tryUISubmit() and the new submitForm() would
blissfully return Status::newGood(), even when it isn't good.

Bug: T191933
Change-Id: I4e35c5a71800f88b2063dd0361d83a56f54d58c3
2018-05-24 20:25:28 +01:00
Fomafix
384dc90874 Avoid sorting the language array twice
Language::fetchLanguageNames returns already a sorted array. An
additional ksort is only needed when inserting a new value.

Change-Id: If8c7b16fa6e7dfe1545f72ac9c742a2f43eaee57
2018-05-22 23:02:34 -07:00
Ed Sanders
70e9ff4917 Preserve 'ooui' query string when overriding
Change-Id: I32df23b427f18e6275beaa6cc10cd58dc3b6eb36
2018-05-08 21:24:41 +00:00
Ed Sanders
4633f4d46a Special:Preferences: Create flag to enable OOjs UI
This reverts commit 808e45d13d.

Bug: T117781
Change-Id: I152b82bcd647d97062eb82cd2d1064609124f9bc
2018-05-03 15:23:14 +00:00
James D. Forrester
225b462a50 Drop deprecated EnableAPI and EnableWriteAPI settings
The siteinfo API response's 'writeapi' value is now hard-set to true,
as are the ResourceLoader variables wgEnableAPI and wgEnableWriteAPI,
to be deprecated later.

Bug: T115414
Change-Id: I54ff9428b247ba203d67aba079149393f323d5a9
2018-04-18 00:30:34 +00:00
Max Semenik
ba35762773 Log DefaultPreferencesFactory usage
Bug: T190425
Change-Id: I17e4792501811787ce90195c07915876d6c233e8
2018-04-09 14:45:11 -07:00