Page MenuHomePhabricator

PageActions Menu should use Builder pattern and reuse existing Menu elements
Closed, ResolvedPublic5 Estimated Story Points

Assigned To
Authored By
pmiazga
Apr 24 2019, 4:34 PM
Referenced Files
F29678758: Screen Shot 2019-07-03 at 11.08.50 AM.png
Jul 3 2019, 6:12 PM
F29678715: T221792-x.png
Jul 3 2019, 5:53 PM
F29678732: T221792-6.png
Jul 3 2019, 5:53 PM
F29678721: T221792-y.png
Jul 3 2019, 5:53 PM
F29655260: T221792-3b.png
Jun 27 2019, 2:22 PM
F29655296: T221792-5b.png
Jun 27 2019, 2:22 PM
F29655277: T221792-4.png
Jun 27 2019, 2:22 PM
F29655281: T221792-4b.png
Jun 27 2019, 2:22 PM

Description

In the T214715: [Spike] How should menus work in Minerva? we did a research on Menu building in Minerva skin. We came to conclusion, that we can and we should construct all menus in the same way. This approach will

  • give us more flexibility, it should be easy to modify/replace menu elements
  • extract PageActions logic from SkinMinerva class
  • allow us to unit test menu building logic
  • reduce the way how we build menus

In the T216152: AMC Navigation - add new links to main menu with click tracking we re-organized the code and used the Builder pattern to build MainMenu. In the same time we merged T216418: AMC Navigation - overflow menu which introduces the new overflow menu.
We should refactor the PageActions menu building to match new way how menus are built.
The proof-of-concept is available on gerrit: rSMIN9909b2d05d2d: POC: PageActions menu built using Builder pattern

Acceptance Criteria
  • PageActions menu building logic is removed from SkinMinerva class
  • PageActions menu is built using Builder pattern. Menu/Group and Menu/IMenuElement are used as building blocks
  • Any extensions that inject menu elements to the Page actions bar still works properly
  • Shared logic from SkinMinerva class (if any) should live as a separate service that is used both in SkinMinerva and PageActions menu builder
  • The Page Actions menu works same way as it used to
QA Steps

On Beta cluster verify:

  • PageActions works the same as it used to for anonymous user
  • PageActions works the same for AMC user
  • PageActions works the same for non-amc user
  • PageActions overflow menus work the same for NS_MAIN and NS_USER namespaces

Additionally on local env/reconfigured staging please verify

  • Toolbar menu works as expected when the AMC mode is disabled (Important) - staging env has AMC mode disabled for the test
  • PageActions works properly if OverflowMenu is not enabled

QA Results

Event Timeline

pmiazga triaged this task as High priority.Apr 24 2019, 4:35 PM
pmiazga moved this task from Incoming to Needs Prioritization on the Web-Team-Backlog board.

We discussed this some and think the menu system should be modified minimally. Whenever a new menu item is added, it will be placed in the action bar. Except if there are already four items items there, then it will be placed in the submenu. This will allow us to use the new menu building system without changing the existing design or spending more time thinking about how to build the perfect menu system.

Per async estimation: Piotr as the only one voted medium, everyone else (Jon, Nick, Jan, Stephen) voted Large.

pmiazga set the point value for this task to 5.May 1 2019, 4:19 PM
pmiazga moved this task from Needs Prioritization to Upcoming on the Web-Team-Backlog board.

Change 510101 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Hygiene: Deduplicate MenuEntry uniqness check code

https://gerrit.wikimedia.org/r/510101

Change 510125 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Introduce new SimpleMenuElementWithIcon

https://gerrit.wikimedia.org/r/510125

Change 510101 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Hygiene: Deduplicate MenuEntry uniqness check code

https://gerrit.wikimedia.org/r/510101

Change 511756 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] PageActions menu elements should be built by using IMenuElement

https://gerrit.wikimedia.org/r/511756

Change 512224 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Untangle watchstar icon

https://gerrit.wikimedia.org/r/512224

Change 512225 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Watchstar should respect iewmywatchlist|editmywatchlist permissions

https://gerrit.wikimedia.org/r/512225

Change 512295 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Use Builder pattern when

https://gerrit.wikimedia.org/r/512295

Change 512300 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Hygiene: Use PermissionsManager instead of deprecated methods

https://gerrit.wikimedia.org/r/512300

Change 512306 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Hygiene: Extract isAllowedPageAction into MinervaPermissions

https://gerrit.wikimedia.org/r/512306

Change 512449 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] Hygiene: SkinUserPageHelper should support Title = null

https://gerrit.wikimedia.org/r/512449

Change 512225 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Watchstar should respect viewmywatchlist|editmywatchlist permissions

https://gerrit.wikimedia.org/r/512225

Change 512449 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Hygiene: SkinUserPageHelper should support Title = null

https://gerrit.wikimedia.org/r/512449

Change 512224 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Untangle watchstar icon

https://gerrit.wikimedia.org/r/512224

Change 511756 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] PageActions menu elements should be built by using IMenuElement

https://gerrit.wikimedia.org/r/511756

Change 512295 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] PageActions menu should use Builder pattern

https://gerrit.wikimedia.org/r/512295

Change 512300 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Hygiene: Use PermissionsManager instead of deprecated methods

https://gerrit.wikimedia.org/r/512300

@pmiazga is there anything left to code review on this?

Change 510125 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Introduce new SingleMenuEntry

https://gerrit.wikimedia.org/r/510125

Change 518288 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/skins/MinervaNeue@master] MinervaPermissions must respect $wgHideInterlanguageLinks config

https://gerrit.wikimedia.org/r/518288

Change 512306 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Hygiene: Extract isAllowedPageAction into MinervaPagePermissions

https://gerrit.wikimedia.org/r/512306

Change 518288 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] MinervaPermissions must respect $wgHideInterlanguageLinks config

https://gerrit.wikimedia.org/r/518288

Test Result

Status: ✅ PASS
OS: macOS Mojave
Browser: Chrome
Device: MBP
Emulated Device: iPhoneX

Test Artifact(s):

QA STeps

✅ AC1: PageActions works the same as it used to for anonymous user
The language button is disabled in the screenshot below because the page wasn't available in another language.

betaeswiki
T221792-1.png (2×1 px, 288 KB)
Screen Shot 2019-07-03 at 11.08.50 AM.png (1×752 px, 650 KB)

The screenshot below shows a page in beta where the language button is enabled because the page is available in another language.

T221792-x.png (2×1 px, 190 KB)

✅ AC2: PageActions works the same for AMC user
The language button is disabled on this page in Beta, see AC1.

betaeswiki
T221792-2.png (2×1 px, 388 KB)
T221792-2b.png (2×1 px, 382 KB)

✅ AC3: PageActions works the same for non-amc user
The language button is disabled on this page in Beta, see AC1.

betaeswiki
T221792-3.png (2×1 px, 305 KB)
T221792-3b.png (2×1 px, 779 KB)

✅ AC4: PageActions overflow menus work the same for NS_MAIN and NS_USER namespaces
The language button is disabled on this page in Beta, see AC1.

betaeswiki
T221792-4.png (2×1 px, 383 KB)
T221792-4b.png (2×1 px, 279 KB)
T221792-4c.png (2×1 px, 270 KB)
T221792-4d.png (2×1 px, 341 KB)

Additionally on local env/reconfigured staging please verify

✅ AC5: Toolbar menu works as expected when the AMC mode is disabled (Important) - staging env has AMC mode disabled for the test
The language button is disabled in staging for a page without additional languages. See below for an example of a page with additional languages.

stagingenwiki
T221792-5.png (2×1 px, 207 KB)
T221792-5b.png (2×1 px, 331 KB)

T221792-y.png (2×1 px, 343 KB)

✅ AC6: PageActions works properly if OverflowMenu is not enabled

staging
T221792-6.png (2×1 px, 362 KB)

@pmiazga thanks for your help!