Page MenuHomePhabricator

When a ProfileMenu has a link item that adds URI parameters, highlight it when clicked
ClosedPublic

Authored by epriestley on Mar 30 2019, 7:18 PM.

Details

Summary

Depends on D20352. Fixes T12949. If a user adds a link (for example, to a workboard) that takes you to the same page but with some URI parameters, we'd prefer to highlight the "link" item instead of the default "workboard" item when you click it.

For example, you add a /query/assigned/ "link" item to a workboard, called "Click This To Show Tasks Assigned To Me On This Workboard", i.e. filter the current view.

This is a pretty reasonable thing to want to do. When you click it, we'd like to highlight that item to show that you've activated the "Assigned to Me" filter you added.

However, we currently highlight the thing actually serving the content, i.e. the "Workboard" item.

Instead:

  • When picking what to highlight, look through all the items for one with a link to the current request URI.
  • If we find one or more, pick the one that would be the default.
  • Otherwise, pick the first one.

This means that you can have several items like "?a=1", "?a=2", etc., and we will highlight them correctly when you click them.

This actual patch has some questionable bits (see some discussion in T13275), but I'd like to wait for stronger motivation to refactor it more extensively.

Test Plan
  • On a portal, added a ?a=1 link. Saw it highlight properly when clikced.
  • On a workboard, added a link to the board itself with a different filter. Saw it highlight appropriately when clicked.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Mar 30 2019, 7:18 PM
epriestley requested review of this revision.Mar 30 2019, 7:19 PM
epriestley added a comment.EditedMar 30 2019, 7:22 PM

Here's exactly what this is talking about in fewer words.

This workboard has a default item called "Workboard" pointed at /project/board/25/.

I've added a link item called "Workboard (My Tasks)" pointed at /project/board/25/query/assigned/.

By default, the board looks like this:

I can click "Workboard (My Tasks)" to quickly jump to a view of the board showing only tasks assigned to me:

Before, this view worked but the menu item did not highlight correctly. Now, it highlights correctly.

amckinley accepted this revision.Apr 1 2019, 7:26 PM
This revision is now accepted and ready to land.Apr 1 2019, 7:26 PM
This revision was automatically updated to reflect the committed changes.