In some edge cases the RequestContext::getTitle() can return null
instead of Title object. Similar situations already happened in the
past (see T179833). The RequestContext::getTitle() documentation
says it can return null, therefore code should be resilient and
support such situations, even if there are not common.
Bug: T221792
Change-Id: I842f8c49f20e511fda3b081e59a06586810bc748
Ensure SkinUserPageHelper::isUserPage() returns true for user pages
that are IP addresses.
Also adds the page-action menu to all user pages.
Bug: T220114
Change-Id: I3703899bc9ff0042c74260d36f48a388b78b0b6b
If viewmywatchlist|editmywatchlist permisions were set to false for
anonymous user, MinervaSkin would show a watchstar icon that links
to LoginPage, even if user was logged in. Clicking watching action
would cause browser to reload the page without any effect.
Under the hood - system would redirect to login, and then the login
page would redirect user back to the article page because user is
logged in.
MinervaSkin should respect viewmywatchlist|editmywatchlist
permissions. If user do not have access to watchlist, do not show
watch icon.
Bug: T221792
Change-Id: I26a1133a7ccff6a4adcdc72d594d0902bfa8ff79
Styles the action=history page to resemble it's desktop
counterpart for users in AMC mode.
Bug: T219895
Change-Id: Ide359724a4628f69ef03acee7718d70c698b8faf
The Skin::getNewTalks() is already called in SkinTemplate::prepareQuickTemplate.
There is no need to call this function again, as is pretty heavy. Instead of
calling it second time, just re-use the value stored in the QuickTemplate
Change-Id: I0e9491405f4d760278db3a423ee14e8f80720291
The Group shouldn't depend upon concrete MenuEntry definition.
Different Menus can present different MenuElements. Code should
allow easy extensions, not limit only to single MenuEntry
definition.
Changes:
- introduced IMenuEntry interface
- MenuEntry implements IMenuEntry
- removed isJSOnly from logic as it's related only to one menu
element (Watchstar) and Group shouldn't be aware of some special
handling for some elements. The IMenuEntry shouldn't define this
method
- getName, getComponents, getCSSClasses should have defined return
types
Bug: 1221792
Change-Id: I0646df734e869c26bfa8c3a772200e8258a8acce
The check to verify uniqness of the MenuEntry $name existed
twice, in insert() and in insideAfter() methods. To respect
"do not repeat" yourself rule, we should keep this check
in one place only.
Bug: T221792
Change-Id: I973b0427623e579f97ae47f7c80dc2a9db2fcca7
There is no need to call SkinTemplate::buildNavUrls() as the 'nav_urls'
from QuickTemplate are used only when OverlfowMenu is present. There is
no need to do that heavy calculation unless we really need it.
Change-Id: I003efcdeffe10f6a3a155932a20c09e8f62c747e
MinervaNeue doesn't show any sidebar, only MainMenu and
PagetActions menu. There is no need to call original
Skin::buildSidebar() as the result is not used.
Change-Id: Iec60491d4b45b7b6f6ba23525a4f6af08903bb31
Looks like Title::newFromText() can return null instead
of Title object. Code has to support this edge case.
Bug: T222407
Change-Id: Ie34a26303df8e27247e51ddc2b13e3c2fa59a435
The Commmunity Portal main menu element should be handled
same way as Skin::buildSideBar() does:
- it should ignore "-" -> this is how editors disable the
link
- it should use inContentLanguage() to properly support
different languages
Bug: T216152
Change-Id: I41b2373fd1b55d9d4beaba60eeb362e6188d24de
When advanced mobile contributions is enabled and the overflow menu is
shown:
- The initial state should have no transition. This prevents the menu
from flickering initially. Move the transition to the checked state
only.
- The icons should be available for server-side rendered HTML without
JavaScript. Add wikimedia.ui to the SSR modules.
Bug: T216418#5129152
Change-Id: I3b91f6cdefd4b727c2fb512272d8c4282af632bf
Cleanup ranges from removal of unused variables, fixing of method
case mismatch, collapsing of multiple `if` statement that can be
combined into one.
Change-Id: Ib9d6e2e4d747da699067c0c0a9aab5e8af29aef2
When advanced mobile contributions mode is enabled and
`$wgMinervaOverflowInPageActions` is set, show a secondary overflow menu
on main namespace articles and user namespace pages. The menu content
varies for each namespace. The new submenu is *disabled* by default,
even when AMC is active. This feature should not be deployed until
instrumentation is available.
The secondary menu is rendered in PHP using the existing menu system
with some changes to the template. The checkbox hack is needed for no-
JavaScript keyboard navigation until :focus-within is supported. CSS
additions are documented in the source.
All client side toolbar execution occurs in Toolbar.js. Enhancements are
documented in the source.
Minor changes to the existing download button:
- Move download and edit button initialization to Toolbar.
- Update copy (not visible) from "Download" to "Download PDF".
- When the overflow menu is present, use the "hasText" / label style.
Wikimedia UI icons are copied from OOUI at d00a0ac and seem useful to
expose as HTTP URIs (not data URIs).
The overflow menu does not show for pages provided by the content proxy
since its entries depend on $tpl->data['nav_urls'] being populated.
Bug: T216418
Depends-On: I0781151a8232b6a7b52f79a34298afcecb8e4271
Change-Id: I4b50a0e519024a7ab91dae6ab40b23cf14a03861
We decided to remove the Recent Changes menu entry from Advanced
menu for now, we might come back to it later.
For more info: https://phabricator.wikimedia.org/T216152#5123296
Bug: T216152
Change-Id: I6342e273fdc5f483692de6e1ac238c38d06f3e5f
Changes:
- introduced new icon for Community Portal
- added new menu entry in Advanced Builder that links to
MediaWiki:Portal-url
Bug: T216152
Change-Id: Id38836d8f1a62d4e15181ab10e219d5c5b769ec3
Changes:
- moved all menu elements definitions from SkinMinerva into
a separate Definitions.php file
- moved menu building from SkinMinerva into includes/menu/Main
folder
- introduced Builder pattern for easy menu building
Minerva/Menu/Main/Director takes an Minerva/Menu/Main/IBuilder
and builds the menu. The IBuilders use definitions from
Minerva/Menu/Definitions file, so all definitions can be shared
across different menus
- used ServiceWiring file to register MainMenu Director as Service
- left class_alias for old MenuBuilder as some extensions still use it
- The hooks system have to stay like that as some extensions
are using it (BlueSpiceMultiUpload and GrowthExperiments).
- introduced AdvancedMenu builder for the AMC mode
Bug: T216152
Change-Id: I210c3f1fa36bbd2f9108d728b12cbb21ee210354
SkinOptions array was used to determine which options are available
for current session. Once we started extracting things from
SkinMinerva class, we found out that lots of things depend on
SkinOptions.
For example MainMenu/PageActionsMenu depend on skinsOptions var.
We could pass $skin object as dependency to a menu builder, but
this would cause a circural dependency (Skin depends on menu builder,
menu builder depends on skin) which is an anti-pattern.
In order to avoid such situations lets prepare first, and extract
the SkinOptions to a separate class, register it as a service
so different parts of Skin Minerva can freely use a single instance
of SkinOptions object.
Bug: T216152
Bug: T221012
Change-Id: Icd5da546e1bfaf8d9bfe86dab3b659a88eae19e4
SkinMinerva cached the ContentHandler object for better performance.
In the future the ContentHandler will be also used in the Menu,
for better readability, store ContentHandler as Service.
MediaWikiServices will initialize service on first access and cache
it for future needs. Same applies to SkinUserPageHelper,
Bug: T216152
Change-Id: Ia98dc860862360a68556272714669f0c3a13eb1e
To help us test special pages prior to moving them on mobile it
would be useful to make AMC the default on desktop
where the special page override does not exist
This is also probably what editors on desktop using the Minerva
skin want out of the skin.
On top of this, add an amc class to the body tag so we can
target styles at AMC and/or non-AMC users
Change-Id: I7f3141bae71181131ae4878fd21fb6ff4322c8ca
- Reduce MinervaTemplate.getPageActions() visibility from public to
protected. No one seems to use it.
- Use camelCase instead of lowercase for the pageActionMenu.mustache
template's pageActions variable. writingwithcaseindifference is
difficult to read and the templates seem to support casing.
Change-Id: I6d283c7b97eeef6902cb010904748bd8c72b660c
The conditional and comment here were probably copied from
MonoBook or Vector. There, they were used to decide whether
to output an H1 or not.
The way the conditional was placed here, though, was a no-op.
When this condition was false ($pageTitle == '') the implicit
behaviour was to leave $heading unchanged, which is '', hence
it is using the very value it pretends to reject.
Remove this indirection as it behaves the same either way.
Change-Id: Id3056b199172bbd21b350f920dd0640241b0dd95
The page actions bar should not show on the following
pages:
?action=history
?action=edit
?action=unwatch
?action=watch
Change-Id: Ib54c332a221d4a1b64064807e693c8882ef97938
This module produces 6 icons:
["clock", "profile"] * ["black", "gray", "white"]
of which only 3 are needed: clock-gray, clock-white, profile-gray.
This patch removes the module and moves the "clock" and "profile"
icons into `skins.minerva.icons.images`. Since that module
does not inline SVG's, the additional cost of adding these icons,
which are loaded at startup, is minimal.
The editLocked.svg icon has also been edited to correct its color.
Bug: T218807
Change-Id: Ib54960eb556dfe0c1ae06d2f73d4f350e519e20f
These code cleanups involves the following;
- Consistency in using single quotes as already been
used in the code base for loading resource loader
test modules.
- Remove irrelevant else cases when there is a return
statement in the if cases.
- Remove passing objects as references as they're already
by default passed by references so no need for &.
- Proper call to getLocalURL() instead of getLocalUrl()
though PHP doesn't really care much about the case but
let's use the function names as they are.
- Fix PHPDoc params, remove useless $skin wrongly placed
in the comment.
The changes in this patch doesn't affect the behavior of
the current system in any way.
Change-Id: I9c886c058592486b7190b9567f79c496855f4ae3
Suppress the redlink drawer for User namespace pages. The redlink drawer
prompts the user to create a missing page but this hinders the usual
workflow for User page visits specifically. A User page is connection to
an account's contributions, age, and other activities and encouraging
the creation of a missing User page when trying to view these
connections is a hindrance, especially if the missing User page is not
associated with the current user.
Bug: T201339
Change-Id: I784493a8ecf28176b5a393cb52d7bfa9fa9b1309
This patch refactors the markup and JS associated with the page actions
menu in order to achieve greater flexibility in its presentation.
The menu items are now positioned via flexbox and rendered using a mustache
template in PHP.
The goal of this refactor is to accommodate both AMC mode and default
mode with the same markup. No changes should be visible for non-AMC
users with this refactor. No changes to AMC mode have been made in this
patch either.
This patch includes temporary workarounds to avoid problems caused by HTML caching.
Changes include:
- Changing the data structure of the page_actions property in SkinMinerva.php
- Passing that modified data structure into a new mustache template, PageActionMenu.mustache
- Adding new CSS for the new page actions menu HTML
- changing the query selectors in JS to match the new markup
- Making the JS-modified page-actions compatible with the new markup
- Keeping existing CSS and JS to avoid breaking cached HTML
Bug: T213352
Depends-On: I95cf726c4b6d8c3895a26aa6e07f4b1747ee30fe
Change-Id: I5a7d73b20617cb3c6d6379084ac4bea23ec3bc74
In T214724 the talk tabs were removed from the main page in
AMC mode, however this also removed the talk button
altogether in AMC mode. This updates the logic.
Talk tabs are also
removed from the talk page for the main page
as the tabs come as a pair.
Bug: T214724
Bug: T216514
Change-Id: Ic7d54e323d9428fa222e27a86ec2f9d61ae1e5f5