Mark all "My" menu links as external

Custom menu links may use URLs that are not covered by the client
router. When following a link that shares the domain, it will be
intercepted by the catchall route and a visual 404 will be mistakenly
shown. With this change, all of the custom links in this menu are marked
as external so that following them causes a full reload and a 404 is
shown only in the appropriate case.

Change-Id: I1cad36de97786a0f9af42e08105ab485fa198a15
This commit is contained in:
Wyatt Allen
2017-09-06 17:37:22 -07:00
parent ed173a26dd
commit 660e180e4e
2 changed files with 9 additions and 3 deletions

View File

@@ -219,6 +219,12 @@
// makes assumptions that work for the GWT UI, but not PolyGerrit,
// so we'll just disable it altogether for now.
delete linkObj.target;
// Becasue the "my menu" links may be arbitrary URLs, we don't know
// whether they correspond to any client routes. Mark all such links as
// external.
linkObj.external = true;
return linkObj;
},

View File

@@ -58,9 +58,9 @@ limitations under the License.
{url: 'https://awesometown.com/#hashyhash'},
{url: 'url', target: '_blank'},
].map(element._fixMyMenuItem), [
{url: '/q/owner:self+is:draft'},
{url: 'https://awesometown.com/#hashyhash'},
{url: 'url'},
{url: '/q/owner:self+is:draft', external: true},
{url: 'https://awesometown.com/#hashyhash', external: true},
{url: 'url', external: true},
]);
});