Commit graph

41 commits

Author SHA1 Message Date
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
Moriel Schottlender
d13b22c474 RCFilters: Hide 'reload watchlist automatically' setting if RCFilters is enabled
Bug: T186277
Change-Id: I78a2bae5f8d0e6f947276c69fa1806eeaad46197
2018-03-26 18:30:37 +03:00
James D. Forrester
6d4e15476c Title: Refactor JS/CSS page handling to be more sane
Change-Id: Ia7837dc614dcc8896a7d4b6d663dc45b6bd4f7ee
2018-02-16 17:35:12 +00:00
Umherirrender
3124a990a2 Use ::class to resolve class names in includes files
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
2018-01-27 20:34:29 +01:00
Max Semenik
55497cdc1a Phan: resolve and reenable PhanAccessMethodProtected
Change-Id: I2bd7c787012f4f54600f3289d9d0d725f87788bc
2018-01-23 09:31:13 -08:00
Umherirrender
23ef520a1c Improve some parameter docs
Change-Id: I31e983d7ac287158101b18ad95779d83537302a2
2018-01-07 11:39:08 +01:00
Sam Wilson
2e248f0bb2 Convert Preferences class into PreferencesFactory service
This deprecates the Preferences class and replaces it with
a PreferencesFactory service. Basically, all code from Preferences
is moved into DefaultPreferencesFactory. All Prefereces methods
are now either shims calling DefaultPreferencesFactory or just
throw exceptions.

Bug: T178449
Change-Id: Id0b2db0c2de0890f6e1609a9a0dca207c4600f99
2018-01-03 09:48:25 +08:00