Commit graph

658 commits

Author SHA1 Message Date
jenkins-bot
c309a5dd25 Merge "Remove the fallback for create rights (covered in PM edit rights check). Remove key to i18n message, no longer being used." 2021-06-30 15:16:39 +00:00
Roman Stolar
6ebaa5caf6 Remove the fallback for create rights (covered in PM edit rights check).
Remove key to i18n message, no longer being used.

Bug: T272079
Change-Id: Id6566e5241b06ba377c2eca083221ee02556365f
2021-06-30 17:30:30 +03:00
Sam Smith
3bcf989f72 hooks: Remove deprecated SkinTemplateBuildNavUrlsNav_urlsAfterPermalink hook
The SkinTemplatePreventOtherActiveTabs hook was marked as deprecated in
MediaWiki 1.35.

Bug: T284950
Change-Id: I9a4806047f8d31d59a00e02145906672b85c004c
2021-06-24 17:25:46 +01:00
Sam Smith
a11aceb214 hooks: Remove deprecated SkinTemplateTabAction hook
The SkinTemplateTabAction hook was marked as deprecated in MediaWiki
1.35.

Further, there are no SkinTemplatePreventOtherActiveTabs hook handers in
codebases that we index [0].

[0] https://codesearch.wmcloud.org/search/?q=SkinTemplateTabAction

Bug: T284950
Change-Id: I998bf8ffe6be43ad3eb38b1a9388a35aa94d7685
2021-06-24 17:25:15 +01:00
Sam Smith
99786a9492 hooks: Remove deprecated SkinTemplatePreventOtherActiveTabs hook
The SkinTemplatePreventOtherActiveTabs hook was marked as deprecated in
MediaWiki 1.35.

Further, there are no SkinTemplatePreventOtherActiveTabs hook handers in
codebases that we index [0].

[0] https://codesearch.wmcloud.org/search/?q=SkinTemplatePreventOtherActiveTabs

Bug: T284950
Change-Id: I37c5bdcc8875a23798f641161e53be3e4d073d7d
2021-06-24 17:24:39 +01:00
Nicholas Ray
c64ba635ce Add icon to personal url menu items
Per T284594, adds an icon key/value for the following personal url menu
items so that it is easier for skins to use the appropriate icon:

* login
* logout
* mytalk
* preferences
* watchlist
* mycontris (user contributions)
* anontalk (talk page for anon user)
* anoncontribs (contributions for anon user)
* createaccount
* userpage

Bug: T284594
Change-Id: I95f2a0a01134f2c3dfc22083be66c99de26b530f
2021-06-23 10:05:02 -06:00
Thiemo Kreuz
2ba01c7ee7 Remove some more comments that literally repeat the code
… including PHPDoc tags like `@return <type> $variableName`.
A return value doesn't have a variable name. I can see that
some people do this intentionally, repeating the variable
name that was used in the final `return $var;` at the end
of a method. This can indeed be helpful. I leave a lot of
these untouched and removed them only when it's obviously
wrong, or does not provide any additional information in
addition to what the code already says.

Change-Id: Ia18cd9f25ef658b08ad25b97a744897e2a8deffc
2021-06-18 21:23:56 +00:00
bwang
085a15211f SkinMustache: Add html-before-portal default value
To mirror the html-after-portlet template variable, it will
be possible for skins to define HTML before a portlet. For now
this can only be modified by skins.

Depends-On: I32586a379cbacaad5cfb361facf79c01e982818a
Change-Id: Ia64e7d4009cf303494ff455e1596286bcca811d9
2021-06-15 21:34:12 +00:00
jenkins-bot
1129e71774 Merge "Factor out data required for creating a logout link" 2021-06-14 21:30:56 +00:00
Jan Drewniak
d638cad995 Factor out data required for creating a logout link
Factors out logic that's responsible for assembling data for the logout
link in a public SkinTemplate::buildLogoutLinkData function.

This function is required by the new version of the Vector skin to
reposition the logout button outside of the personal tools menu.

Bug: T281791
Change-Id: If82a736e37174aaadd0ff07019a1fae3759a9e51
2021-06-14 23:11:29 +02:00
bwang
0448859ab6 Hard deprecations of portlet methods and hooks
Hard deprecates BaseTemplate::getAfterPortlet
Hard deprecates BaseTemplate::renderAfterPortlet
Hard deprecates BaseTemplateAfterPortlet Hook

Bug: T280608
Depends-on: I15ed3c820823782d28f11f3724d56736db0ca3e0
Depends-on: Ie00e8c5efe9a1e736251382344a7ae8cd779bb6b
Change-Id: If3e15aa81edb4190b5a74353c089b200acf3f62b
2021-06-14 19:28:46 +00:00
Petr Pchelko
92564edc7c Use Message::page instead of Message::title
Also modified new APIs added to ApiErrorFormatter to
use PageReference instead of Title.

Change-Id: I093c89f8e1e6d383603f887358be6ece70f23a02
2021-06-09 13:18:22 +00:00
jenkins-bot
fbb29d06f5 Merge "Skin: Remove duplicated code" 2021-06-03 01:23:53 +00:00
Clare Ming
412e8f25f7 Add user-interface-preferences to personal toolbar.
- Update $content_navigation in SkinTemplate::buildContentNavigationUrls() to include a new top-level menu.
- Exclude user-interface-preferences menu from content navigation in legacy skins.
- Add method makeSkinTemplatePersonalUrls() to SkinTemplate to build personal urls.
- Rename method to injectLegacyMenusIntoPersonalTools() to add legacy menu items.
- Update unit test for renamed method injectLegacyMenusIntoPersonalTools().

Bug: T282196
Change-Id: If4805e5186756056afcd31d21919e907a7782ce8
2021-06-02 12:47:16 -06:00
Petr Pchelko
ee5a5f2dd7 Remove User from SkinTemplate::buildContentNavigationUrls
Change-Id: I6eec8248bde75ee90f87a49413f8de556beca5a0
2021-05-30 10:04:29 -07:00
jenkins-bot
b693065c32 Merge "Skin: Factor out functions" 2021-05-27 00:22:51 +00:00
bwang
dee771bf8b Skin: Factor out functions
Allows for the creation of create account and login urls in SkinVector

Change-Id: Ia841f92c626ca32a9ad437b3d1cff78309c83ed8
2021-05-26 17:49:13 -05:00
Isarra
6268b3a708 Skin::getCopyrightIcon: ensure it hasn't been unset in config
Sysadmins could unset the entire copyright array in FooterIcons.
Might as well make sure it exists at all before checking if it has
something usable. Also simplifies related testing.

Change-Id: I56e06d564a9d60851d10e69065fd70dd51025bd2
2021-05-23 19:09:28 +00:00
jenkins-bot
4d33cae7ce Merge "Make mw-content-body universal to all skins" 2021-05-14 01:08:19 +00:00
jdlrobson
7cda5b0bf8 Make mw-content-body universal to all skins
1) Rename content-parser-output to `content-body`

Widen the scope of this module to apply to anything that can be rendered
as the article body. Improve the documentation on what is allowed here.

For early-adopter skins already using content-parser-output,
map the feature to the new name and add tests.

2) Reclaim the `mw-body-content` class for result of
SkinTemplate::wrapHTML

The `mw-body-content` has been used in skins to wrap various elements.
Going forward we will use it to wrap any HTML content generated by
OutputPage.

See dependent patches, which we're not directly depending on to avoid
a CI gremlin:

 - I90d85c21f4a62e6697f24e3ce388445a0a53c2b0 (MonoBook)
 - I11242e243c9a529b72972089af9ac2a8c906331a (Modern)
 - I87942c60e62f6f14acdfeaa1836ace4eac9252ac (CologneBlue)
 - I4c1b15d90bacbc9b13782a1d8f52e838ce8ecd83 (Vector)

Bug: T279388
Change-Id: I3a91b294fcb3724cd46743e497dff723de0490a6
2021-05-13 16:53:52 -07:00
jenkins-bot
297d1bfb0e Merge "Remove unused default values from class properties" 2021-05-13 00:58:34 +00:00
jenkins-bot
de0ac77e45 Merge "Modern keys must be unset" 2021-05-12 23:38:48 +00:00
Isarra
44a0238f1a Remove mw-body-content class from BaseTemplate::getIndicators
Bug: T279388
Change-Id: I785bd09d01e3b004df2f0fb898d7d8f28180501c
2021-05-12 19:31:14 +00:00
jdlrobson
f311d3b8dc Modern keys must be unset
This was really badly documented. Monobook and Timeless menus are generated using
the old BaseTemplate methodology. These new keys need to be unset to keep
compatibility. This code probably needs refactoring, but for now an explanatory
comment should help avoid this happening again.

Bug: T282646
Change-Id: I050a03abd90a94138dd6591d6f92af7e1515a9c9
2021-05-12 16:57:40 +00:00
Jdlrobson
f942d65171 Revert "Revert "Create buildPersonalPage method for SkinTemplate class, add menu item to personal menu..""
This reverts commit cefb0c4b35.

Reason for revert: This creates some problems in a new mode of Vector
we're testing. The fix for the originally reported problem is simpler
and a patch will follow.

Change-Id: I78ea52ac79dd08f053c3920af4a882b8446c4ed4
2021-05-12 15:49:39 +00:00
Thiemo Kreuz
6805f39a30 Remove unused default values from class properties
In all these cases the property is unconditionally set in
the constructor. The extra initialisation is effectively
dead code and an extra source of errors and confusion.

Change-Id: Icae13390d5ca5c14e2754f3be4eb956dd7f54ac4
2021-05-12 13:44:28 +02:00
jenkins-bot
675694308c Merge "Revert "Create buildPersonalPage method for SkinTemplate class, add menu item to personal menu.."" 2021-05-12 06:31:50 +00:00
Legoktm
cefb0c4b35 Revert "Create buildPersonalPage method for SkinTemplate class, add menu item to personal menu.."
This reverts commit 5c7a0f84f2.

Unannounced breaking change for skins, causes weird tab to be
added on MonoBook and Timeless skins.

Bug: T276561
Bug: T282646
Change-Id: I35a7b9ded2be5401294d74fd59269b874793ad4c
2021-05-12 05:43:59 +00:00
Ammarpad
88fb4dd871 Skin: Remove duplicated code
This check is now in Skin::getRelevantUser() method itself and
so is pointless to repeat.

It was supposed to be removed in I177cd83 but was restored
unintentionally in one of the rebases

Follow-up: I177cd83a9c4f87c27a63d8f530c40895d0f3f5dd
Change-Id: Ic1758775ecd6992e162f1e7461a9ae7afdc9bcd0
2021-05-10 16:32:52 +00:00
Isarra
489564b35d getFooterIcons should not return empty arrays, part 2, Electric Boogaloo
We filter out icons with no images, which includes empty icon arrays,
already. Let's also remove their containers if nothing winds up inside
them so we're not returning any empty container arrays, either.

Bug: T278266
Change-Id: If9bfb764b61a77e71ca7f374fa67a56ac89c799f
2021-05-09 20:12:06 +00:00
Clare Ming
5c7a0f84f2 Create buildPersonalPage method for SkinTemplate class, add menu item to personal menu..
Inside buildPersonalUrls method, replace personal_urls variable with method call to build personal page link. Add "user-page" menu to content navigation. This patch is a dependency for a corresponding patch in the Vector repo which needs the new "user-page" menu item to update the personal toolbar based on a feature flag.

Bug: T276561
Change-Id: If4e143aada711d210ae45d33b97a6be0685b6a41
2021-05-04 23:31:01 +00:00
DannyS712
40eda16b0e Remove deprecated talk page message handling in User class
Most needed for moving forward with the removal of uses
of the Revision class, and remove User::getNewtalk at
the same time to be consistent. All of this code was
already hard deprecated in 1.35.

- User::getNewtalk
- User::getNewMessageLinks (could return Revision objects)
- UserRetrieveNewTalks hook (could return Revision objects)
- User::getNewMessageRevisionId (used ::getNewMessageLinks)
- User::setNewtalk (accepted Revision object parameters)

Bug: T247143
Bug: T277511
Change-Id: Ib4fd1e4cbc5ba1497658190b6c6ea3c6a5dc97f0
2021-05-04 19:21:06 +00:00
vladshapik
9cc797695b Hard deprecate User ::isIP, ::getOptions
Bug: T275602
Change-Id: Id4be13751ca0a900e51214c1855a4624077a5a62
2021-04-26 16:10:24 +00:00
Cindy Cicalese
a384acffa7 Use WatchlistManager in several classes
Change-Id: I720629e08373736b5fc1e12563b5059311b113e1
2021-04-21 00:37:40 -04:00
jenkins-bot
f05d54738b Merge "Fix annoying E_NOTICE about undefined 'alt' index in Skin#makeFooterIcon." 2021-03-28 02:17:55 +00:00
Cormac Parle
679497c171 Allow public access to getter for default search page
Bug: T273979
Change-Id: I241a9cce679c7b42ff749c6236299d82b94db669
2021-03-24 14:20:56 +00:00
ZabeMath
e91c0ad729 Hard deprecate BaseTemplate::getFooterIcons()
BaseTemplate::getFooterIcons() is soft deprecated since 1.35 and unused.

Bug: T267447
Change-Id: Iff952cff08a5c93b93ab75743ea6f1e18067572f
2021-03-23 13:44:11 -07:00
jenkins-bot
8a21504083 Merge "Allow top-right search form target to be modifiable" 2021-03-16 14:44:50 +00:00
Ammarpad
1c8cda3e87 Skin: Restore use of Authority in place of PermissionManager
This was done originally in Ie530051, but it seems was partially
reverted when I177cd83 was merged.

Change-Id: Ib699f3519a12b442adcd31938a1394918f3a74f7
2021-03-15 07:55:29 +01:00
Cormac Parle
adda9c0555 Allow top-right search form target to be modifiable
Before this patch, if 'search' is in the request params then we always
go to Special:Search. Also, the 'title' param on the top-right search
form is always set to Special:Search, which means that form always goes
to Special:Search too.

In order to allow the search form to go to a different page, this
patch:
1. moves the hardcoded redirect to Special:Search based on 'search' in
the request params, so that it only happens if we cannot determine
the page title in the usual way
2. adds a setter for the default search page title in \Skin, so that
it can be set in a hook

Bug: T273879
Change-Id: If62573d19ca76ed1db53a5117182172233e514ab
2021-03-12 17:38:13 +00:00
jenkins-bot
cd083821aa Merge "Use getHTMLTitle instead of getDisplayTitle" 2021-03-10 11:26:55 +00:00
jdlrobson
8d0edcda45 Use getHTMLTitle instead of getDisplayTitle
Per docs, getHTMLTitle
Return the "HTML title", i.e. the content of the "<title>" tag.

getDisplayTitle can return HTML

Bug: T157145
Change-Id: Ib9aa89d10a1263308b5426306f2c8b046084553b
2021-03-08 12:26:46 -08:00
Ammar Abdulhamid
242b9b2f6a Enforce concealment of hidden RelevantUser at Skin level
Skin is what takes a user or extract it from a title to set relevant
user and so this is the right place to handle permission check too
because if the user is hidden, it should be made known for all
callers, instead of hoping each caller will do similar check
which is duplication and not guranteed.

Skin:setRelevantUser always takes user and this is now typehinted to
avoid errors. Callers need to give what's required.

Bug: T120883
Change-Id: I177cd83a9c4f87c27a63d8f530c40895d0f3f5dd
2021-03-08 15:38:07 +01:00
Petr Pchelko
ea185c872e Rename Authority::getPerformer() to ::getUser()
We started to call Authority argument $performer everywhere,
and $performer->getPerformer() doesn't look that good.

Change-Id: Id2cf3f27b18340314e4ed1ea9931ad9404b4df6f
2021-03-04 12:45:28 -07:00
Petr Pchelko
bb990c7e94 Convert skin code to Authority where ready
Change-Id: Ie530051d7abb3137e0e79114cb01dbb129ae0fe0
2021-02-23 21:04:19 -07:00
jdlrobson
a3a4e6ad74 Add to configuration to allow addition of certain tags to page
The following fields are needed for the display of Twitter cards
In conjunction with Ie5889b4a4a5685298fe00ecced0dbebb91d7f87c this
should provide the minimum to let cards render on Twitter.

By default this change will have no effect on page rendering,
to avoid any conflict with existing solutions, for example in
Wikidata.org.

Bug: T157145
Change-Id: I7f6cf7b415ad122b24c428cee2df2d3fed362395
2021-02-18 21:40:59 +00:00
Umherirrender
8de3b7d324 Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
2021-02-11 00:13:52 +00:00
mainframe98
c40f955312 Skin: Add notifications and user-menu content navigation
This allows separating notifications from personal tools.
The notifications are still inserted into the personal tools,
after the userpage, for skins using BaseTemplate, skins that
call buildPersonalUrls without the argument, skins that call
either getStructuredPersonalTools, makePersonalToolsList without
providing it personal tools or getPersonalToolsList.

Mustache skins that use data-personal are unaffected, and can
retrieve personal tools without notifications from data-user-menu
and notifications from data-notifications, both of which are in
the data-portlets array.

Notifications are manually inserted in both SkinTemplate and
SkinMustache to prevent calling buildPersonalUrls multiple times.

For backwards compatibility with user code and gadgets, the new
user-menu portlet uses the same id and classes as the personal
tools, allowing it to serve as a drop-in replacement.
Skins shouldn't output both.

Bug: T266613
Depends-On: Ib4112364c173952eb363e52756f03693a2e03512
Change-Id: Ia1451e3e802441162eecfc5b7f6a7ba2ae72f377
2021-01-26 22:33:40 +00:00
jdlrobson
cf2785e606 Content navigation links can provide their own IDs
Currently IDs are forced on skins. To aid the transition of
CologneBlue to Mustache it should be possible for skins to set
an ID key to override this behaviour in custom menus.

Change-Id: I3f3d5caf380425b463d840e487749dc06433f763
2021-01-13 16:35:38 +00:00
jenkins-bot
658cb99a4b Merge "Emit deprecation warning for deprecated overrides." 2021-01-13 04:06:55 +00:00