Commit Graph

350 Commits

Author SHA1 Message Date
Stephen Niedzielski 0867ff03aa [fix] [notifications] fix icon width
When notifications are present, the wrong icon width was used. Set the
icon width and remove a useless class, main-header-button.

https://codesearch.wmflabs.org/search/?q=main-header-button&i=nope&files=&repos=

Change-Id: Ie274ffcc93cf576f36eb0fccee80ecd3d4ac3a21
2019-08-02 14:39:04 -06:00
jenkins-bot 7cca6b42f8 Merge "Hygiene: SkinOptions should know what are AMC options" 2019-08-02 18:52:50 +00:00
jenkins-bot 628e7a703a Merge "Hygiene: remove deprecated calls from Menu system" 2019-08-02 18:51:42 +00:00
jenkins-bot ca5afd9ac0 Merge "Hygiene: remove deprecated calls from MinervaSkin and MinervaTemplate" 2019-08-02 17:09:36 +00:00
jenkins-bot 573a08ddf5 Merge "Hygiene: Simplify if statement and move comment" 2019-08-02 16:35:48 +00:00
jenkins-bot 0c4186746a Merge "Hygiene: Wrap userMenu and pageActions into prepareMenus" 2019-08-02 16:31:24 +00:00
Piotr Miazga ab1d39ea4f Hygiene: Wrap userMenu and pageActions into prepareMenus
Changes:
 - introduce preapreMenus()
 - move getUserMenuHTML logic into prepareMenus
 - move preparePageActions logic into prepareMenus
 - rename 'page_actions' into 'pageActionsMenu' to be consistent

Change-Id: Ie8cc137f749741074e1a5787bee67893fc45fde9
2019-08-02 17:39:31 +02:00
jenkins-bot 6f96dfe664 Merge "AMC features should default to true in desktop" 2019-08-02 15:17:06 +00:00
jenkins-bot 01ca1602e1 Merge "Hygiene: Rename MainMenu related classes" 2019-08-02 15:17:05 +00:00
Piotr Miazga ec77b3ab25 Hygiene: remove deprecated calls from MinervaSkin and MinervaTemplate
Changes:
 - Title::getTalkPage() is deprecated, use NamespaceInfo instead
 - Title::getSubjectPage() is deprecated, use NamespaceInfo instead

Note: NamespaceInfo returns LinkTarget instance, but most of our
logic is wrapped around Titles, that's why we need to call
Title::newFromLinkTarget() to be sure that we got Title object.

Change-Id: Ibf2237ea369b0cee67ab5f623bdddcd9058eec3e
2019-08-02 17:04:53 +02:00
Piotr Miazga 3b13e6b9f6 Hygiene: remove deprecated calls from Menu system
Changes:
 - Title::getTalkPage() is deprecated, use NamespaceInfo instead
 - Http::isValidURI is deprecated, use MWHttpRequest instead

Change-Id: I6938fe93d18372ef855f398a506c8b5ba68b640e
2019-08-02 16:49:11 +02:00
Piotr Miazga 05cdcc09c8 Hygiene: SkinOptions should know what are AMC options
Do not hardcode special handling of Options in other places
than SkinOptions. SkinOptions should be only one place that
knows all interpedences.

Change-Id: I9ad8c1560332665dbcd88ccc7105fb253a2f41b9
2019-08-02 16:26:52 +02:00
Piotr Miazga b03e24aa9c Hygiene: Rename MainMenu related classes
For better readability Main Menu building classes should
contain MainMenu in the name as not everyone uses smart
IDEs.

Change-Id: Ica3bf4bbd18cab1a6cd88061dfb9d1ce51b0f63d
2019-08-02 14:20:00 +00:00
jenkins-bot 7c869ec86a Merge "Remove all main_menu tracking related code.""" 2019-08-02 14:06:23 +00:00
Piotr Miazga 0ac08cafb2 Hygiene: Simplify if statement and move comment
It feels like the comment about history link time should be located
next to the getHistoryLink function, not somewhere in the code.

Statements like:

  if ( a ) {
    if ( b ) {
      // do sth;
    }
  }
can be easily wrapped into:

 if ( a && b ) {
   // do sth
 }

Change-Id: I98c071ecdd855210bc0a92f032ee622fb91e8df5
2019-08-02 15:38:18 +02:00
jdlrobson 9aae174a15 AMC features should default to true in desktop
It is expected that in mobile mode, onRequestContextCreateSkinMobile
hook will explicitly set skin options based on the user configuration.

The desktop should however reflect everything with AMC enabled.

Bug: T229295
Change-Id: Ib3bf09c25d9bcf9b31d994b92a1d016cca8a6224
2019-08-01 18:04:00 -07:00
jdlrobson 97f0e44e19 Reset SkinOptions after logging out
Bug: T221137
Change-Id: I36ada157327b649900dbcee3917883fe8ee7687a
2019-08-01 21:57:36 +00:00
Jdlrobson 8d703b7758 Remove all main_menu tracking related code.""
This reverts commit de353c06c9.

Bug: T228681
Change-Id: Idfd964c31e09e271dca9ac39f7932df49cdcb5f6
2019-08-01 10:40:09 -07:00
Piotr Miazga 4efd72a879 Hygiene: Remove OPTIONS_ and OPTION_ prefixes from SKinOptions
Additionally, renamed couple options for better readability.

Bug: T221012
Change-Id: Ia347a60d469fba8f35afa7c70aa806a46271dccd
2019-08-01 10:34:03 -07:00
jenkins-bot eac1686792 Merge "Set title from Skin relevant title" 2019-08-01 00:10:08 +00:00
Piotr Miazga 9ece509c99 Hygiene: SkinOptions should validate options
Changes:
 - when trying to set unknown option, throw exception
 - added unit tests

Bug: T221012
Change-Id: I0d1a43fb5a7179b8e9cd578e3e33bab12ddfd61c
2019-07-31 22:24:29 +00:00
jenkins-bot e030193ced Merge "Limit Recent Changes disable-table mode to Minerva skin" 2019-07-31 19:01:41 +00:00
jdlrobson c4c0254963 Limit Recent Changes disable-table mode to Minerva skin
Bug: T228280
Change-Id: I6e2298d3721ec0d09f8867af89f22d26210ed6bb
2019-07-31 11:39:40 -07:00
Piotr Miazga 7b5e210ed8 Show warning when user tries to use enhanced RecentChanges view
Bug: T228516
Change-Id: I16e3d69b410f20a3f70f4bb213a279664613f725
2019-07-31 15:32:58 +00:00
Kosta Harlan 2669afe911 Set title from Skin relevant title
This allows extensions which set relevant title to make use of theme elements
rendered by Minerva on pages where UserPageHelper returns true for isUserPage.

See also I20cce5bd58cdfbf21c0917905df15ee1f36e68d1

Bug: T225663
Change-Id: I4c1add98167ae908a05b2224adea0c417eb4a290
2019-07-31 13:17:49 +02:00
jenkins-bot 531fed3ea1 Merge "Set correct action for watchstar link" 2019-07-30 21:21:34 +00:00
jenkins-bot 31e3931034 Merge "💩 Avoid usage of deprecated isFeatureAvailableInContext() method" 2019-07-30 20:51:25 +00:00
jenkins-bot fd38627869 Merge "Subtitle appear below page actions" 2019-07-30 20:26:32 +00:00
Piotr Miazga 4f01ff9e23 Set correct action for watchstar link
Does exactly what it says on the tin

Bug: T229228
Change-Id: I87a4b8c0aa529b2494e67f1a97e95819fc2cf87e
2019-07-30 22:10:34 +02:00
Stephen Niedzielski 805cc92e73 [UI] [AMC] add recent changes to the AMC menu
This mostly reverts commit 692309090d and
updates the icon.

Bug: T224216
Change-Id: I7200aaef5a15479afb4bc99f5195e900351a055a
2019-07-30 11:27:34 -06:00
jdlrobson 87a0795ed8 Subtitle appear below page actions
Bug: T217197
Change-Id: I6582db82ac750783dffa5612c9a0b3ccc86749a1
2019-07-30 09:59:58 -07:00
Derick Alangi ddf6dece1a 💩 Avoid usage of deprecated isFeatureAvailableInContext() method
Change-Id: Ic7459fc7630ee6add20415ce632d39c118913645
2019-07-30 12:45:04 +00:00
Stephen Niedzielski 8dbd511e88 [fix] [AMC] load main menu icons on desktop Minerva
The main menu icons are needed in the user menu by the no-JavaScript
desktop Minerva experience which does not have an active
SkinOptions::OPTION_OVERFLOW_SUBMENU option. This was introduced in
Ic6a2490fbd3903c5d34ff8267d745fdd93c73fd2.

Bug: T214540
Change-Id: I780e5639057f236d6ff91675f82cf4682520021a
2019-07-29 12:23:28 -06:00
jdlrobson 406f211be1 Enable AMC styles if only one of the AMC properties is enabled
Bug: T229024
Change-Id: I46f4d6ef4529cea2953e3edde3a3e5eb579f24ec
2019-07-25 22:11:52 +00:00
jdlrobson f0503a52d0 Refresh the user, bell and search icon
* New module skins.minerva.icons.wikimedia provides icons
from Wikimedia UI in Minerva
* search selector in skins.minerva.content.styles.images is
retained for cached HTML
* skins.minerva.icons.loggedin now a
ResourceLoaderOOUIIconPackModule and bell removed from repo.
* userAvatar replaced with userAvatarOutline

Bug: T224070
Change-Id: Ibed609371060acc4b69e5cd4cd4f20edc871b3ba
2019-07-25 16:35:01 +00:00
Piotr Miazga ad04f31441 Follow-up: User menu improvements
Changes:
 - We should limit the interfaces we pass around,
  AdvancedUserMenuBuilder doesn't need whole IContextSource as it
  uses only msg() method. It's better to define that this methods
  needs only MessageLocalizer
 - move UserMenuDirector into ServiceWiring to be consistent with
 other Directors/Builders
 - pass PersonalTools as a dependency to UserMenuDirector, which
 will pass to each Builder. The personalTools is set of links
 that can/should be used when rendering user menu (which in the
 fact has almost same subset of tools as the personal toolbox)

Bug: T214540
Change-Id: I7f744651b0665452a5a9d1ce661f20547e80812d
2019-07-25 08:41:22 -06:00
Piotr Miazga e117ee433a Follow-up: clean up old Advanced Menu builder and add hook support
Old MainMenuAdvancedBulder doesn't require the personal section
any more as that section is handled by new UserMenu.

Additionally we should add hook support in the new UserMenu so
different extensions can add their own menu entries.

Bug: T214540
Change-Id: Ibbfbee9d13d58c92d90a22d2b6dcf124b1313c23
2019-07-25 13:50:01 +02:00
Stephen Niedzielski 0a4f5b6126 [UI] [new] add user menu
Add new user menu. The changes required include:

- Break up AuthMenuEntry into reusable components. They're now simple,
  independent, static functions in AuthUtil that are easy to reason
  about and compose.

  There's lots of verbose code because of the builder and director
  patterns. That is, most of the code is for building the thing we
  actually want to build instead of just building it. It's easy to write
  but no fun to read--even simple configurations are extremely verbose
  expressions that must be threaded through the system.

  These builders are also single purpose and unlikely to be reusable
  unlike a URI builder, for example. As objects, they're not especially
  composable either.

- Similarly, break up Menu/DefaultBuilder into BuilderUtil and ban
  inheritance. Inheritance has not worked well on the frontend of
  MobileFrontend. I don't think it's going to work well here. E.g., I
  could have made changes to the base class' getPersonalTools() method
  such that the client passes a parameter for the advanced config or
  maybe I just override it in the subclass. In either case, I think it
  makes the whole hierarchy nuanced and harder to reason about for
  something that should be simple.

- Add ProfileMenuEntry and LogOutMenuEntry for the user menu.

- Rename insertLogInOutMenuItem() to insertAuthMenuItem() which matches
  the entry name, AuthMenuEntry.

- Extension:SandboxLink is needed to display the sandbox link in the
  user menu.

- Performance note: the toolbar is now processed in MinervaTemplate,
  which corresponds to removing the buildPersonalUrls() override.

- To mimic the design of main menu, the following steps would be
  necessary:

  1. Create a user/Default and user/Advanced user menu builder and also
     a user/IBuilder interface.
  2. Create a user/Director.
  3. Create a service entry for Minerva.Menu.UserDirector in
     ServiceWiring. The Director is actually powerless and doesn't get
     to make any decisions--the appropriate builder is passed in from
     ServiceWiring which checks the mode.
  4. Access the service in SkinMinerva to set a userMenuHTML data member
     on the Minerva QuickTemplate.
  5. In MinervaTemplate, access the userMenuHTML QuickTemplate member
     and do the usual song and dance of inflating a Mustache template.

  This patch does everything except add a service, which was agreed to
  be unnecessary, so that logic is now in SkinMinerva.

- Wrap the existing echo user notifications button and new user menu
  button in a nav element. This seems like a semantic improvement.

- The existing styling and logic for the search bar and search overlay
  are pretty messy and delicate. Changes made to that LESS endeavored to
  be surgical. There's lots of room for improvement in the toolbar but
  it's out of scope.

- Rename logout icon to logOut.

Bug: T214540
Change-Id: Ib517864fcf4e4d611e05525a6358ee6662fe4e05
2019-07-24 18:24:07 +00:00
Stephen Niedzielski 933dc0e370 [dev] Replace menu entry inheritance with functions
Break up Menu/DefaultBuilder into functions that are reusable without
inheritance. The functions do not need much state to produce their
outputs and a weighty inheritance hierarchy makes the code difficult to
reason about. The functions are used in a following patch for the user
menu. They're now simple, independent, static functions in BuilderUtil
that are easy to reason about and compose.

Also, ban inheritance via `final` in a few places nearby. Inheritance
has not worked well in MobileFrontend and enabling it should be a
special deliberate case, not a default. E.g., in the user menu, the
changes could have been to the base class' getPersonalTools() method
such that the client passes a parameter for the advanced config or maybe
just override it in the subclass. In either case, it makes the whole
hierarchy nuanced and harder to reason about for something that should
be dead simple.

Bug: T214540
Change-Id: I6e9a2b36a1bff387eb3b33ea65b0a6806962810a
2019-07-23 18:07:02 -06:00
Stephen Niedzielski f068dc7af5 [dev] split AuthMenuEntry
- Separate AuthMenuEntry into reusable parts.

- Add some missed finals in nearby classes.

Bug: T214540
Change-Id: Icf285bf8d2b791dd1aa4ee37ae90d27afe42bd91
2019-07-23 18:07:00 -06:00
Stephen Niedzielski ff57ba7cd9 [dev] make interface for overriding menu profile URL
Make an interface for changing the URL of the menu profile item. This
functionality is needed by Growth and a subsequent patch will provide a
second profile implementation that should implement this interface.

Bug: T214540
Change-Id: Ie3647ac52a83b4cc34f3582a41c5d5524343965c
2019-07-23 12:23:45 -06:00
jdlrobson 6830ffcfea Disable the recent changes table-based layout on Minerva
See Ib68ff8fa782ac12479ef02247cdf78e405b64bad

Bug: T228280
Change-Id: I4169bcb93eb6680c0e9251873afb5637014c0e1b
2019-07-22 23:29:04 +00:00
Pmiazga de353c06c9 Revert "Remove all main_menu tracking related code."
This reverts commit d11c84d08b.

We decided to track both old MobileWebMainMenuClickTracking and new MobileWebUIActionsTracking for some time. Then once everything goes stable and it's proven to work correctly we will merge d11c84d08b.

Bug: T220016
Change-Id: Ib4d52e8b8c870774041284e575564a9933af6136
2019-07-22 18:31:55 +00:00
jenkins-bot 9352a70023 Merge "Remove all main_menu tracking related code." 2019-07-19 16:24:49 +00:00
Piotr Miazga d11c84d08b Remove all main_menu tracking related code.
This code should live in WikimediaEvents extension, not in
Minerva.

Bug: T220016
Depends-On: Ic2d6d1b21b0eb72ad68b0c447bc63f7d1bb021f4
Change-Id: Iaeb12704dcd257f0783f1ebec3def01cb2848228
2019-07-19 15:30:28 +00:00
jenkins-bot 2d9be80368 Merge "Use wikimedia.ui from core directly" 2019-07-17 15:15:12 +00:00
jdlrobson e27debc1dd Use wikimedia.ui from core directly
There's no reason to copy and paste all this here. These icons
can be imported directly from core using ResourceLoaderOOUIIconPackModule

Depends-On: I7800da87a6a10399f705b43e05c8592c766bae6f
Change-Id: I1f25aaca9b7313cd95cefc7f5629b8a7e65c887f
2019-07-16 22:20:25 +00:00
jenkins-bot 6076c61772 Merge "Embrace packageFiles" 2019-07-16 21:21:42 +00:00
jenkins-bot 297a2c3aeb Merge "Extract language/variants check to a service" 2019-07-16 21:16:51 +00:00
jenkins-bot 937d2b48ea Merge "On user pages, move language icon from Toolbar to Overflow menu" 2019-07-16 20:09:04 +00:00