Commit graph

156 commits

Author SHA1 Message Date
Umherirrender
4d42b5e86e docs: Change wording master to primary in comments and log text
Bug: T254646
Change-Id: I5379dc79be60c99f0a30f74e5d624f81fe6f921b
2021-09-01 23:04:40 +02:00
Petr Pchelko
bfa145fae7 Convert second batch of special pages to authority
Depends-On: Ifc82d29a00d3fd136c44e0699e6bbfa11b8cf2a6
Change-Id: Iaf559a72cc47ec5d2481d7f740ad0eb303c94002
2021-03-04 15:37:59 -07:00
Umherirrender
fc794afe9a Inject services into SpecialRecentChanges/SpecialRecentChangesLinked
This covers only directly used services by this special page and pager
Services used by the base class are not part of this patch set

Bug: T259960
Depends-On: I62855be191ea87bdc5157b6ab879c47815644156
Change-Id: I730ce17548fad3e35e8d8b6730eb3aafd734eac9
2020-11-25 08:53:46 -08:00
Umherirrender
8fccad62ff Inject services into SpecialPreferences
This covers only directly used services by this special page
Services used by the base class are not part of this patch set

Bug: T259960
Change-Id: Ia4a022719f572952dcb62953c8819feb3326eccd
2020-11-23 21:07:43 +00:00
Thiemo Kreuz
1fc8d79ac6 Remove documentation that literally repeats the code
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.

Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.

Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
2020-10-27 19:20:26 +00:00
Thiemo Kreuz
64ef8f95a8 specials: HTMLForm::factory() method calls can be chained
Change-Id: I76a9179a0f03c23b28a7b59eb7b90aed5dfe1176
2020-09-08 16:20:44 +02:00
Sam Wilson
5e0fd6d664 Remove PreferencesFactory::setUser()
This method was recently added and was to result in the deprecation
of a few places where User objects were being passed to the factory.
This has now been reconsidered and this patch reverts to the
previous behaviour. It is largely a revert of Ie1bed9e9537cabc836992ccfa7fb127885ea3e11

Bug: T238466
Depends-On: Idc9f33fd5ab55bde88cc306ca63adead286380a8
Change-Id: I3653559704ccfd9bca0946f5a865be93bdf5ceb6
2020-06-08 00:27:04 +00:00
Reedy
bc24bf7c4f Fix some Squiz.Scope.MethodScope.Missing
Change-Id: I06a663403816e62aa261210538865554cad8eab1
2020-05-16 22:18:49 +01:00
Sam Wilson
36defc20eb Add PreferencesFactory::setUser()
Add a new setUser() method to PreferencesFactory so that a User
object doesn't have to be passed around so much. This is how
GlobalPreferencesFactory has done it, and so after this change
that code can be removed from GlobalPreferences.

Bug: T238466
Change-Id: Ie1bed9e9537cabc836992ccfa7fb127885ea3e11
2020-05-06 09:04:08 +08:00
Petr Pchelko
7b4eafda0d Replace usages of deprecated User::isAllowed. Step 2.
Bug: T220191
Depends-On: I509cd88355cfd0cc074f4135ec86399b4075f89f
Change-Id: I2341e6f1d108c92924620fba3c64ec090cb09918
2019-09-11 16:00:03 -07:00
Reedy
571a44a4be Replace PreferencesFormLegacy usages with PreferencesFormOOUI
Change-Id: I4fc2a609ebb0f93b0767dddc343c3ff93ca8a39c
2019-04-14 00:51:05 +00:00
Thalia
2d2bb3720a Introduce TagMultiselectWidget.php
TitlesMultiselectWidget and UsersMultiselectWidget share
a lot of functionality, so implement a common base class.

This also adds some things to UsersMultiselectWidget:
* shows a pending element to users with JavaScript
* makes the input configurable

Change-Id: Ie6649b476c64e795254f457e3863fa7f14aa05ac
2018-12-14 15:18:11 +00:00
James D. Forrester
7858460d2e Special:Preferences: Drop isOouiEnabled() before it gets released
Depends-On: Ic1df4e965df61c2d164b2ffd2fa07ed68b028ddf
Depends-On: If0e83751089d010d026a736040d77b9a0851ef42
Depends-On: Id9c840e979b723806883bb3e63d7f2f691fea629
Depends-On: I9d5dbf449c624233cef2ccf0e3e4200d9eb2b7c3
Change-Id: If2a21a6a40802ab187b30de78fb521f016dd10cd
2018-10-03 23:59:48 +00:00
James D. Forrester
dcf3eb793a Special:Preferences: Drop non-OOUI legacy form version
Change-Id: I65b89385c3ec28ef01b86dd933dae3801e503631
2018-10-01 17:47:02 -07:00
Bartosz Dziewoński
376bcd30ee SpecialPreferences: Escape HTML in tab titles in legacy form
They shouldn't intentionally contain HTML (except by abuse of
PreferencesGetLegend hook), and other than trivial formatting,
it wouldn't display correctly because they are styled as links.

It is already being escaped in OOUI form.

Change-Id: I303afe92fcb0208d1a2b040321866c0c95f27aa9
2018-09-03 21:22:46 +02:00
James D. Forrester
540538eba2 Special:Preferences/reset: Always use OOUI not the deprecated vform
Though it's "nice" to show this as a big red button to users, sadly
(a) vform is deprecated and shouldn't be used, and (b) the format's
restriction on button width intereferes with the length of the sole
control on this form, even without the prolix override expansion of
for which wikis' communities are wont to do.

Bug: T195977
Change-Id: Icc294bde1d3ed72837e7152003a2fbd522c9067d
2018-05-30 16:25:07 +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
Ed Sanders
fc65ff17d9 Special:Preferences: Construct fake tabs to avoid FOUC
Bug: T192769
Bug: T189366
Change-Id: I4aabda97d14d97dce3e35abda2ce82925d721c9b
2018-05-18 18:10:45 +00:00
Ed Sanders
508080f1f3 OOUI prefs: Use late static binding
Allow sub-classes to disable OOUI for now (e.g. GlobalPrefs).

Change-Id: Ic3ff878b5f0ba7ec4162fab09fe1b9e10a820095
2018-05-11 09:57:04 +01: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
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
Bartosz Dziewoński
808e45d13d Revert "Special:Preferences: Use OOjs UI" and follow-ups
The number of issues with the new interface is unacceptable and we
will not be able to fix them reasonably quickly. See subtasks of
T180538 for the list of issues, raised both by the Wikimedia community
and by WMF employees.

I should have pushed back harder against the merging of this half-baked
change with the promise that we'll fix it later. I convinced myself
that the regressions were not so noticeable and that the issues that
were pointed out will in fact be fixed by someone. Predictably,
however, regressions were bad and the only person fixing the issues
was me.

I am not going to work nights to make this page decent again within a
reasonable timeframe; I'm not sure if I'd even be able to since many
issues are problems with the design rather than the implementation. No
one else seems to be working on improving it, therefore I am reverting
the change.

On the bright side, this work has resulted in a number of improvements
to HTMLForm and Preferences code, which are not being reverted here:
<https://gerrit.wikimedia.org/r/#/q/topic:T117781>.

If anyone reattempts this, I recommend gating the new interface behind
a configuration variable and URL parameter, like we did with
$wgOOUIEditPage in the past, and testing thoroughly in production
before enabling it for everyone.

* Revert "Special:Preferences: Use OOjs UI"
  This reverts commit 486e566cfe.
* Revert "Preferences: Show preview of edit fonts in edit font selector"
  This reverts commit 6634ff729d.
* Revert "Follow-Up Iae63b6994: Add missing editfont dependency"
  This reverts commit ce42fdf151.
* Revert "Preferences: Improve visual appearance by “unboxing” sections"
  This reverts commit c9415bb005.
* Revert "Remove box-shadow from preference panels for ooui-apex"
  This reverts commit a934b82ca2.
* Revert "Preferences: Don't show the watchlist token; just link to ResetTokens"
  This reverts commit e8c9102fc7.
* Revert "mw.special.preferences: Make the "Basic information" section more compact"
  This reverts commit d48b7260f3.
* Revert "mw.special.preferences: Widen the dropdown of the "Time zone" field"
  This reverts commit afd5f1417e.

Bug: T117781
Bug: T180538
Change-Id: I44b5daea1828f71881b5bd35218f5ecb7ab7f36e
2017-12-02 22:32:08 +01:00
jenkins-bot
52e76843e2 Merge "Special:Preferences: Use OOjs UI" 2017-11-14 22:52:14 +00:00
Bartosz Dziewoński
486e566cfe Special:Preferences: Use OOjs UI
* Change the form to OOUI mode. Tweak some formatting to look better
  with this mode. Change various random links to be OOUI buttons.
* Rewrite custom tabs to use OO.ui.IndexLayout instead.
* Update styles and JS enhancements for OOUI widgets.
* Rename ResourceLoader modules so that old skin-specific styles
  (from $wgResourceModuleSkinStyles) no longer apply. They tend
  to make no sense with the OOUI styling.

Bug: T117781
Change-Id: Ie9396f0146f5020e52710c41e55ec86151ae0095
2017-11-13 20:51:09 +01:00
Sam Wilson
e6479374bd Make it possible to override SpecialPreferences::showResetForm()
Change-Id: I390e9d46fd2b8d4d8a1f9fd250c964a696b48244
2017-11-07 15:49:18 +08:00
Ori Livneh
a603ae73a7 Fix letter-case of several namespace and class names
'Mediawiki\Widget\SelectWithInputWidget' is the only one that shows up
in the logs, but I tidied up a few others I came across.

Change-Id: I700dec858007a8013e6d7b9e37ddf518f223d8b7
2017-10-14 21:43:05 -04:00
Sam Wilson
05a7239ab3 Make it possible for subclasses to provide a different form
This makes it possible for subclasses of SpecialPreferences to
specify a different HtmlForm to use for the preferences' form.

Bug: T68869
Change-Id: I9d6bbc6383a3d5b5c6839394de49ce9ca81efec9
2017-08-10 13:15:16 -04:00
Brian Wolff
14beae88b5 SECURITY: Do not directly redirect to interwikis, but use splash page
Directly redirecting based on a url paramter might potentially
be used in a phishing attack to confuse users.

Bug: T109140
Bug: T122209
Change-Id: I6c604439320fa876719933cc7f3a3ff04fb1a6ad
2017-04-06 13:42:38 -07:00
Max Semenik
2b51bd1847 Fix function name case
Change-Id: Ibd4f682d2ed8500a50d85aae38f17281646f7c2d
2016-09-26 15:32:54 -07:00
Fomafix
a4efd27998 Directly use getSession for specialPreferencesSaveSuccess
Change-Id: If9017f6c42f4c8f697504e3b92cee8bfb907b8e7
2016-08-29 07:52:37 +02:00
Florian
1f15863aa7 Use mw.notification for success message on Special:UserRights
Split out Special:Preferences handling of successbox into it's own
mediawiki.notification.convertmessagebox module and make it reuseable.

Use this module on Special:UserRights.

Bug: T115463
Change-Id: I87054b55053d209835d6fdea1f6e3e67f10e3ac8
2016-07-29 23:14:43 +02:00
Aaron Schulz
d27042fd25 Avoid DBPerformance log warnings in SpecialPreferences
Preference views do not need the master DB.

Change-Id: Id0c3fc6d453b6af0eca8450107da6d554c822347
2016-04-14 16:22:54 -07:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
7798b70e7e Define which SpecialPage classes expect write vs read mode
Bug: T123591
Change-Id: I521ebdd5e8eb8f7f4df927dc38732170aef2ac19
2016-01-14 14:40:37 -08:00
Fomafix
486bc2073a Preferences: Use session data instead of URL parameter for success
The session data gets set in the POST and gets deleted in the GET.

This change avoids changing the URL for the success message.
A reload of the page does not show the success message again.

The URL manipulation in mediawiki.special.preferences.js is superfluous.

Bug: T26700
Change-Id: I1c2b011e7a66b2b9379dd4a3fdcc6f978dd43b52
2016-01-09 22:41:46 +00:00
Aaron Schulz
26ca2b6409 Avoid CAS update errors on password reset
This could be caused by double posts or hook conflicts.

Bug: T95839
Change-Id: If362c8d0c9f9ded76b185cd717638b06775be885
2015-12-21 20:17:36 -08:00
Aaron Schulz
b046b93d93 Avoid "CAS updated failed" errors on Special:Preferences double post
* This does the same thing ApiOptions does to avoid these errors.
  A new getInstanceForUpdate() method is now in the User class to
  simplify this pattern.
* Avoid overriding $user in ApiOptions for code readability.
* Fixed IDEA errors around Preferences::getFormObject() return type.

Bug: T95839
Change-Id: If2385b7486c043bd70d7031ff35e37dfb079a4d2
2015-12-15 02:50:16 +00:00
Derk-Jan Hartman
db7257ffd5 Rework the Preferences to prevent FOUC
New styles modules that is always added, so that all JS specific styling
is guaranteed to load before first paint. Reworked the HTML to generate
the preftoc (hidden when user has no JS).

Set htmlform nolabel class to use !important, so that it doesn't get
overriden by the 20% width rule of labels.

Also requires changes to the skinstyles of Vector preferences, which
is an a separate patch (I59f0f45), and other skins.

Bug: T115692
Change-Id: I24d9b16ed6729fdf0d59adcc2f0ba16f4f621b44
2015-11-08 19:42:56 +00:00
Geoffrey Mon
dabc661f41 Preferences: Fix issues from 6d3c65b5b0
* Use .mw-preferences-messagebox instead of .successbox to
  avoid conflicts with other Special pages using '.successbox'
  as a class and so that the new class can be used to check
  for messages to replace with notifications
* Add logic to check for messages to replace using the new
  aforementioned class
* Use Html::rawElement and Html::element instead of Xml::tags
  to add the non-JS successbox
* Re-added <p> tags around non-JS successbox message that were
  accidentally ommitted in the original patch

Bug: T19496
Change-Id: I990667aa114d8201516bee6cb2ad22994de53c6c
2015-09-03 21:45:21 +00:00
Geoffrey Mon
6d3c65b5b0 Use notification on successful preferences save
"Now 98.6% leaner!"

* Use Xml::tags() for cleaner (old) successbox generation.
* Use #mw-preferences-success for the old successbox
  to make its removal more specific.
* Use the mw.notify box for saved prefs message.
* Remove box on keydown or mousedown in #preftoc or
  .prefsection.
* Remove success=1 querystring on load to prevent
  unnecessary reappearance of notification on reload.

Bug: T19496
Change-Id: Ibecbe21aa52ddc061d4bb27815f6fa5161a96735
2015-08-01 23:05:06 +00:00
Federico Leva
e928d5bdd0 Allow to customise addHelpLink() target via system message
Method similar to SpecialPage::outputHeader() to avoid registering
tons of system messages and to have -summary and -helppage tidily
listed together in Special:AllMessages by default.

Bug: T45591
Change-Id: Ic849dde00be7379c1909a8486cf20f48c5aea5cf
2015-05-15 10:14:28 +02:00
Federico Leva
e2e2859ec2 Add help link to three rather important pages
* Specialpages is a useful hub, but not so visited. The help
  page is currently not that good, but is not controversial either.
* Preferences should obviously be better, but may be better than
  nothing. Some explanations and links there are definitely useful.
* Categories don't worry much and there's no doubt they require more
  education to be really understandable and useful for users. They
  are however sort of content pages, if users start thinking they can
  get help about the contents of the categories of specific wikis
  we'll need to remove the link.

Bug: T45591
Change-Id: I7445419864e85685b3ca0cf8333f38b284c71111
2015-03-05 00:25:56 +01:00
jdlrobson
274978205c Correct button colours of preference page when $wgUseMediaWikiUIEverywhere is enabled
* Apply mw-ui-destructive to Special:Preferences/Reset
  when $wgUseMediaWikiUIEverywhere is enabled

Introduces HTMLForm->setSubmitDestructive()

Bug: 65317
Change-Id: I1d6691dce3e7dab662bda9a718e16c5caee6c041
2014-09-17 00:00:38 +00:00
Kunal Mehta
bc798535fd Deprecate SpecialPage::getTitle
Callers should use SpecialPage::getPageTitle, which is
exactly identical.

This is so that in the future we can turn SpecialPage
into a ContextSource, which requires getTitle to return
getContext()->getTitle.

Change-Id: Icdcf5d5295ef5e7f08b1d403e0c123f78738fd40
2013-12-24 12:53:11 -08:00
Bartosz Dziewoński
cd20fd5995 Remove 'prefsnologin' message, don't use 'watchnologin' where inappropriate
There is no reason why the default can't be used instead.
No other special pages requiring login have special messages for the
title, as far as I know.

Left one use of 'watchnologin' in WatchAction alone, since it also uses
another special message there. This message is also currently used by
the MobileFrontend extension.

Change-Id: I7878ed3692358cee1f5785b34ab48a0cc83c05bc
2013-11-19 20:57:29 +00:00
Bartosz Dziewoński
68f3a22654 Consistently handle anonymous users on logged-in-only special pages
Added new helper function SpecialPage#requireLogin() to check if the
current user is logged in and, if not, format an error message linking
to Special:Userlogin and throw UserNotLoggedIn exception, to be
handled by OutputPage later.

Reused old error messages. Not all use the new parameter and they're
very inconsistent, but this is a matter for another patch.

Used it on 7 special pages. I don't think there are any other ones
which specifically require having an account, instead of just some
rights usually associated with logged-in users.

* SpecialChangeEmail
* SpecialChangePassword: It allows anonymous users under specific
  circumstances, but is logged-in-only in general.
* SpecialConfirmemail
* SpecialEditWatchlist
* SpecialPreferences
* SpecialResetTokens: It was missing the check, added it.
* SpecialWatchlist

Change-Id: I43ceaddb370d09784021b3fc2d5d1ff6616fef1f
2013-11-19 12:03:49 +01:00
MatmaRex
0b539d7fa1 Backport information boxes' styles from vforms to shared CSS
They're obviously prettier and non-intrusive enough to fit old
interfaces. The colors are changed to more pastel ones and the general
size of the boxes is reduced.

Also remove unnecessary bolds on the informations on
Special:Preferences and Special:ChangePassword.

Change-Id: Ieae62db1a124261ae7f5bf67aced8b84cfbadd3d
2013-10-24 20:46:02 +02:00
Bartosz Dziewoński
2e68e7e8b8 Remove calls to deprecated HTMLForm#setTitle
Use DerivativeContext with modified title instead.

Most of those should be using FormSpecialPage…

Change-Id: Ia66f3b4b22866cc4ac4ac7b1f2fc2a4b1a9e73f6
2013-10-13 22:17:35 +01:00