diff --git a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.js b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.js index a77c66d169..78b2e33cb9 100644 --- a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.js +++ b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.js @@ -206,7 +206,10 @@ const topMenuLinks = []; links.forEach(link => { topMenuLinks[link.title] = link.links; }); for (const m of topMenus) { - const items = m.items.map(this._fixCustomMenuItem); + const items = m.items.map(this._fixCustomMenuItem).filter(link => { + // Ignore GWT project links + return !link.url.includes('${projectName}'); + }); if (m.name in topMenuLinks) { items.forEach(link => { topMenuLinks[m.name].push(link); }); } else { diff --git a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html index 582ca61db0..03586eaea6 100644 --- a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html +++ b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header_test.html @@ -191,6 +191,37 @@ limitations under the License. }]); }); + test('ignore top project menus', () => { + const adminLinks = [{ + name: 'Repos', + url: '/repos', + }]; + const topMenus = [{ + name: 'Projects', + items: [{ + name: 'Project Settings', + target: '_blank', + url: '/plugins/myplugin/${projectName}', + }, { + name: 'Project List', + target: '_blank', + url: '/plugins/myplugin/index.html', + }], + }]; + assert.deepEqual(element._computeLinks([], [], adminLinks, topMenus), [{ + title: 'Browse', + links: adminLinks, + }, + { + title: 'Projects', + links: [{ + name: 'Project List', + external: true, + url: '/plugins/myplugin/index.html', + }], + }]); + }); + test('merge top menus', () => { const adminLinks = [{ name: 'Repos',