Commit graph

1553 commits

Author SHA1 Message Date
Piotr Miazga 686e116d60 If the Overflow menu is visible, don't render user links
User links bar has the items already rendered in toolbar/overflow
menus. There is no need to render user links if the overflow menu
is available.

Bug: T224735
Change-Id: I613fa68b6cd43acf07bcb85af77d0239dc6bba6b
2019-06-25 12:25:26 +00:00
jenkins-bot 62090bcd69 Merge "Use wgRelevantPageTitle when setting up talk overlay" 2019-06-25 10:21:53 +00:00
James D. Forrester 7ebab3c9eb build: Upgrade wdio-cucumber-framework to get a working version of fibers
Bug: T226442
Change-Id: Ia3772f620d8bfc511c0d4259734e0ce9a092c679
2019-06-24 14:37:58 -07:00
Translation updater bot 8d89172bac Localisation updates from https://translatewiki.net.
Change-Id: Ifadc568c590df9f67983668f7f8ed8c7455adf0b
2019-06-23 22:11:21 +02:00
jenkins-bot ab3fb1d148 Merge "MinervaPermissions must respect $wgHideInterlanguageLinks config" 2019-06-21 20:13:27 +00:00
jenkins-bot 0d9f6786e4 Merge "Hygiene: Drop isAuthenticatedUser method" 2019-06-21 19:56:44 +00:00
Piotr Miazga bb0071383a MinervaPermissions must respect $wgHideInterlanguageLinks config
MediaWiki Core defined $wgHideInterlanguageLinks that can be used to
disable the interwiki links. Minerva skin should respect this config,
furthermore, this config should take precedence over the Minerva's
$wgMinervaAlwaysShowLanguageButton config.

Bug: T214540
Bug: T221792
Change-Id: Id4fe8b67a17f9c28c00a8a3a207946e146502cde
2019-06-21 18:59:50 +00:00
Piotr Miazga b8d5e3fac5 Hygiene: Drop isAuthenticatedUser method
Is used only in Minerva, and it's so simple, there is no need to
have a special function for that (no improvement no performance,
nor readability)

Change-Id: Id5a4edb077671dc12f58df31273f00a1a816f097
2019-06-21 19:18:27 +02:00
Piotr Miazga 8c7553935e Hygiene: Add return types for known services
We can define return types using `function(): TYPE` notation.
We should do that when it's possible.

For now, it's not possible to type nullable return type (PHP7.1
supports that, but PHP7.0 and most probably HVVM doesn't),

Change-Id: I6b58a882383832313ef47a296c726a4044a97954
2019-06-21 19:06:04 +02:00
Piotr Miazga 6352190684 Hygiene: Extract isAllowedPageAction into MinervaPagePermissions
The isAllowedPageAction is used in multiple places (SkinMinerva
and in PageActions toolbar builder). This logic should be defined
in separate service, easy accessible for different parts of the
Minerva skin.

Changes:
 - Introduced MinervaPagePermissions as a centralized place to manage
 user permissions
 - Introduced MinervaNoTitlePermissions, an NullObject pattern to
 handle situations when we do not have Title object (like in CLI)
 - removed Minerva.ContentHandler service as it's not required any
 more
 - moved all permission names into constants
 - moved isTalkAllowed() into MinervaPermissions
 - renamed isAllowedPageAction() it `isAllowed()` to not mix it
 with PageActions. Those checks are used in many places, not only
 on PageActions menu
 - made isAllowed( watch ) more robust - now it checks that Title
 is watchable

Bug: T221792
Change-Id: I87d44a9c717b5f752b8d1fd2f146d7f5eef3c53f
2019-06-21 15:30:11 +00:00
jenkins-bot 18a1d48d53 Merge "Build: add package-lock file" 2019-06-20 22:13:59 +00:00
Piotr Miazga 806663e158 Extract LanguageSwitcher to separate class
The Language switcher will be used in couple places:
 - Toolbar, if the AMC is off
 - both overflow mmenus when AMC is on

To make code DRY, first we should provide a single way to
create Language Switcher menu element, so we can use same way
in all possible scenarios.

Bug: T224735
Change-Id: I5ba0dbad7089012c7fd1bfc43787775c7e36d575
2019-06-20 17:18:20 +02:00
Stephen Niedzielski 36be88b5b5 Build: add package-lock file
Add package-lock file. The previous version of Node.js did not support
package-locks but v10.15.2 does.

Bug: T179229
Change-Id: I987bfb6f4c4cd0fe5c3f24d45e29c906e18a9e2b
2019-06-20 08:09:44 -06:00
Translation updater bot 4b24daa117 Localisation updates from https://translatewiki.net.
Change-Id: I6343b83298d36d9ae8c240f5fbb5f35c4393dcb5
2019-06-19 23:37:08 +02:00
Stephen Niedzielski 1e61706e0e Hygiene: rename "secondary button" to "user notifications"
The secondary button is not generic. Rename it to match its specific
purpose.

Bug: T214540
Change-Id: I50b7e7fa7bea91a029a8ca71199b0309dff1c518
2019-06-19 11:31:16 -06:00
Stephen Niedzielski 02726555e0 Hygiene: rename user notification build method
Rename SkinMinerva->prepareUserButton() to
prepareUserNotificationsButton(). The function is responsible for
inflating the button that displays notifications when pressed. This name
would be especially confusing when an actual user button is added in
T214540.

Bug: T214540
Change-Id: I8965ef4c5b29ea692d67e821a06131ad5f287287
2019-06-19 11:16:23 -06:00
jenkins-bot 1aa31ea5b8 Merge "Correct Wikidata icon color in overflow menu" 2019-06-19 14:10:38 +00:00
Nicholas Ray 9676395529 Correct Wikidata icon color in overflow menu
This icon's stroke was explicitly set to `#000` before this commit, but
we need its color to be `#54595d` to match the other icons in the
overflow menu [1]. Unfortunately, although we set a variant in skin.json
for the icon to be colored this way [2], there are 2 problems that
prevent it from displaying this color:

1) The icon sets an explicit black color for its stroke attribute
2) ResourceLoader currently only sets the fill color on the `g` element
when applying the variant style [3]. It does not set the stroke color. Even
if problem 1) was removed, we would need RL to set the stroke color, but
I'm not sure how that would affect other variant icons that RL deals
with.

The simplest possible solution is to to change the stroke attribute on
the icon itself, although it unfortunately introduces technical debt as
this icon now differs slightly from the OOUI one :(

[1] https://phabricator.wikimedia.org/T222630#5266575
[2] https://github.com/wikimedia/mediawiki-skins-MinervaNeue/blob/master/skin.json#L262-L267
[3] 4e59467427/includes/resourceloader/ResourceLoaderImage.php (L331)

Bug: T222630
Change-Id: I8c10a6012c7d32ab8555b874e766bc2f36437cf8
2019-06-18 17:05:26 -06:00
Ed Sanders 240280b906 Tabs: Remove unnecessary flexbox styles
white-space:nowrap is simpler and better supported.

Change-Id: I8c44cdd3c30a4cad1817b7912f9bbaae9e5ef641
2019-06-18 21:36:28 +01:00
Stephane Bisson 5a3a8efc31 Use wgRelevantPageTitle when setting up talk overlay
wgRelevantPageTitle is generally the same as wgPageTitle.
It is different on special pages that act on a page.
For example, on Special:WhatLinksHere/Moai
  wgPageTitle => Special:WhatLinksHere
  wgRelevantPageTitle => Moai

This change would allow Special:Homepage to have the talk overlay
connected to its talk tab.

If Minerva has such special pages that act on a page AND those
pages have talk links AND the 'skins.minerva.talk' happens to
be loaded, those links would now show the talk overlay.
I found no such cases but I cannot say they don't exist.
I also don't know if this change would be a regression
or an improvement.

Bug: T225659
Change-Id: I5d60ff3f0295f44a6d59cd772e27656b69ef0972
2019-06-18 15:38:33 -04:00
jenkins-bot 48c3aa0662 Merge "Make the tabs scrollable horizontally" 2019-06-18 16:20:01 +00:00
Translation updater bot fffb5ab379 Localisation updates from https://translatewiki.net.
Change-Id: If6e23b739c2283e79b380104744dd75226d5a732
2019-06-17 22:09:24 +02:00
Translation updater bot 77779ce441 Localisation updates from https://translatewiki.net.
Change-Id: Ic64d6110f83ce3d8a06e1dabf76945e9145951e6
2019-06-16 22:07:40 +02:00
Stephane Bisson 4f5dbf7d55 Make the tabs scrollable horizontally
* Add a container around the tabs and use flexbox
  to position the tabs on one line and make it
  scrollable.
* Add some JS to scroll the currently selected
  tab into view.

Bug: T223142
Change-Id: Ie2205e6836797c2ac000e12a01f78a4aa7bc5b81
2019-06-14 13:50:23 -04:00
Piotr Miazga b8abf809ac Hygiene: rename $navUrls to $toolbox
Previously we were passing the $tpl->data['nav_urls'] array,
because of that all params were called $navUrls. That approach
was incorrect and we have to pass $tpl->getToolbox(), which
means all $navUrls variables/paramters have to be renamed to
$toolbox for better clarity

Changes:
 - renamed $navUrls to $toolbox
 - update phpdocs blocks
 - renamed buildEntry() into build()

Bug: T222630
Change-Id: Id0023cfbb9779c502edc0f91e31a2a912af84084
2019-06-14 19:05:37 +02:00
jenkins-bot 3461c9dd93 Merge "Add wikidata link to overflow menu" 2019-06-14 16:54:12 +00:00
jenkins-bot 11525af55e Merge "Introduce new SingleMenuEntry" 2019-06-14 14:18:51 +00:00
Translation updater bot da4c7757cd Localisation updates from https://translatewiki.net.
Change-Id: I048054483859abd622bfc676fb447ac3e53c5261
2019-06-13 22:13:13 +02:00
Piotr Miazga fa30f03495 Introduce new SingleMenuEntry
Instead of using $group->insert(....)->addComponent() we can define
our own small SingleMenuEntry that defines a standard menu entry with
a label and one icon. The icon name and tracking code by default will
be the same as the menu entry name.

Changes:
 - introduced SingleMenuEntry class
 - updated Definitions class to use new entry instead of using old
 MenuEntry class
 - changed the Contributions meny entry name to match icon/tracking

This should simplify code a bit, thanks to this approach we should be
able to remove the Definitions class in some future and keep building
MenuElements in the builders.

Bug: T221792
Change-Id: I1f145e8cd173b72b01a145b2dba3704593f17ab7
2019-06-13 21:39:37 +02:00
jenkins-bot b7d2352074 Merge "Add missing dollar prefix to jQuery variable" 2019-06-13 19:32:00 +00:00
jenkins-bot 8b32918900 Merge "Revert "temporarily disabling failing browser tests for language selector"" 2019-06-13 18:23:53 +00:00
Niedzielski cb0460aaf5 Revert "temporarily disabling failing browser tests for language selector"
This reverts commit c0b4911670. These
tests seem to be running now.

Bug: T224605
Change-Id: If052e75376ea85d86d395b481f204d3d3049fb3f
2019-06-13 15:24:37 +00:00
Nicholas Ray 162f8aa95c Add wikidata link to overflow menu
The director is now passed the array from `BaseTemplate::getToolbox()`
as all of the server rendered links we show in the main namespace/user
namespace overflow menus (including wikibase) will be in the toolbox
array except for the "Uploads" link in the User overflow menu which is
added in the UserNamespaceOverflowBuilder.

Bug: T222630
Change-Id: I280537c6b8b32036d68a5a004571bb5a41c2e703
2019-06-12 19:50:48 -06:00
Ed Sanders 12e6a2b9d5 Add missing dollar prefix to jQuery variable
Change-Id: Ib6ea281b749e040d43c2dc3558a0a96ce59b7385
2019-06-12 21:29:49 +01:00
Derick Alangi a9ead1938b menu: Add system generated logoutToken on logout action in Minerva
Upon building the menu components for logged in users, the logoutToken
was not properly appended to the logout URL. The URL is supposed to be

`?title=Special:UserLogout&returnto=...&logoutToken=...`

and not what was rendered previously, see below

`?title=Special:UserLogout&<token>`

The absense of the 'logoutToken' param prompted an intermediate step asking
users to confirm the logout action. We don't need this in Minerva if users want
to logout from their accounts and asking users to confirm this action is annoying.

We want the user to be able to logout when the "Logout" button is clicked
and the system would have generated a logout token and appended to the logout
URL in the format specified above. This patch has been tested locally and
everything works just fine.

Bug: T225220
Change-Id: I20f30db707915179a0604a1dc9061d8db225a230
2019-06-11 12:54:37 +01:00
jenkins-bot 808fae37e2 Merge "🐛 Bug: Make the history action's filters form toggleable again" 2019-06-10 19:59:39 +00:00
Translation updater bot 63f4d51f19 Localisation updates from https://translatewiki.net.
Change-Id: I84c95d100a021fc0df687abccb1eaff64fbc839d
2019-06-08 22:12:36 +02:00
jenkins-bot aa522bde58 Merge "Fix indent on json" 2019-06-07 20:27:53 +00:00
Umherirrender 6d957c55e9 Fix indent on json
Bring each key in its own line for better readablity

Change-Id: I4449b976938ded1d6f5c3c05719d8c8d77bd75a7
2019-06-07 21:29:23 +02:00
jenkins-bot d0f40d3eaf Merge "Updating icons for AMC mode" 2019-06-07 14:42:45 +00:00
jdlrobson 37a3045f62 🐛 Bug: Make the history action's filters form toggleable again
Before this commit, the filters form would stay collapsed and the user
couldn't toggle the visibility of the form. This commit fixes that by
loading the necessary modules for the history action to make the form
toggleable again:

- mediawiki.page.ready
- jquery.makeCollapsible
- jquery.makeCollapsible.styles

Additional Changes:

- The explicit addition of the 'mediawiki.action.history' module to the
defaultModules array in SkinMinerva was removed because this module
should already be added by HistoryAction.php and all we are doing with
Minerva is styling it differently.

- The styling to hide the filter revisions box in
skinStyles/mediawiki.action.history.styles.less was removed now that
this functionality should work again

Bug: T223204
Change-Id: Icf4a22a62228aca5a120bcdf3d6fede35b3c928e
2019-06-07 14:27:23 +00:00
Piotr Miazga ececc1b98c Define default OPTION_TABS_ON_SPECIALS option
If the option is not default, system will throw OutOfBoundsException
when trying to access OPTION_TABS_ON_SPECIALS value.

Bug: T225279
Change-Id: I01ff016caea0bfd961c71e15388d670cd93acc7f
2019-06-07 11:44:53 +00:00
Jan Drewniak 0213011285 Updating icons for AMC mode
Replaced the following icons:
- communityportal.svg
- specialpages.svg
- info.svg
- contributions.svg

Bug: T222228
Change-Id: Id7889aeb99abe39bc0efae0a1c6457826015302b
2019-06-07 00:25:21 +02:00
jenkins-bot c99188376f Merge "Add method for getting menu entry by name" 2019-06-06 21:46:26 +00:00
jenkins-bot 129de0821d Merge "Ensure each api call creates a new instance of MWBot" 2019-06-06 19:55:53 +00:00
Kosta Harlan b035d76d0f Add method for getting menu entry by name
* Also fix typo with $returnToQuery
* More usage of DomainException

Bug: T222834
Change-Id: I5623741779eebe4c5694bdbd7a1aa1bcdd7f04c6
2019-06-06 13:04:29 -04:00
Jan Drewniak 018d436bfe Ensure each api call creates a new instance of MWBot
As a hold-over from a previous porting attempt, thw World.js file
(a cucumber.js convention) exported an instance of MWBot. This
instance was used in several tests, however, since MWBot had been
instantiated multiple times since then, the original edit token
was invalid, causing several tests to fail.

Bug: T224947
Change-Id: I56c06600c43d53bbc4e103d446a1de7a52c2cfad
2019-06-06 13:33:54 +02:00
jenkins-bot b64585dfad Merge "Hygiene: Use PermissionsManager instead of deprecated methods" 2019-06-06 00:38:14 +00:00
jenkins-bot 11c4309193 Merge "PageActions menu should use Builder pattern" 2019-06-05 22:19:11 +00:00
jenkins-bot 7bd31a1ef9 Merge "Add hook to override SkinOptions, and allow overriding tabs output" 2019-06-05 21:49:26 +00:00