Merge branch 'stable-3.8' into stable-3.9
* stable-3.8:
Remove extra base URL prefix in gr-copy-links
Release-Notes: skip
Change-Id: Ice94668fa9f38c06b0dced01fa1b40f7686b240a
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
index 85d9000..eb0b510 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
@@ -138,7 +138,7 @@
import {FilesExpandedState} from '../gr-file-list-constants';
import {subscribe} from '../../lit/subscription-controller';
import {configModelToken} from '../../../models/config/config-model';
-import {getBaseUrl, prependOrigin} from '../../../utils/url-util';
+import {prependOrigin} from '../../../utils/url-util';
import {CopyLink, GrCopyLinks} from '../gr-copy-links/gr-copy-links';
import {
ChangeChildView,
@@ -1209,7 +1209,7 @@
private renderCopyLinksDropdown() {
const url = this.computeChangeUrl();
if (!url) return;
- const changeURL = prependOrigin(getBaseUrl() + url);
+ const changeURL = prependOrigin(url);
const links: CopyLink[] = [
{
label: 'Change Number',
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
index fba0392..009a92f 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
@@ -21,6 +21,7 @@
mockPromise,
pressKey,
queryAndAssert,
+ stubBaseUrl,
stubFlags,
stubRestApi,
waitUntil,
@@ -1615,4 +1616,36 @@
copyLinksDialog.copyLinks.some(copyLink => copyLink.value === sha)
);
});
+
+ test('copy links without a base URL', async () => {
+ element.change = createChangeViewChange();
+ await element.updateComplete;
+
+ const copyLinksDialog = queryAndAssert<GrCopyLinks>(
+ element,
+ 'gr-copy-links'
+ );
+ assert.deepEqual(copyLinksDialog.copyLinks[1], {
+ label: 'Change URL',
+ shortcut: 'u',
+ value: 'http://localhost:9876/c/test-project/+/42',
+ });
+ });
+
+ test('copy links with a base URL having a path', async () => {
+ stubBaseUrl('/review');
+ element.change = createChangeViewChange();
+ await element.updateComplete;
+
+ const copyLinksDialog = queryAndAssert<GrCopyLinks>(
+ element,
+ 'gr-copy-links'
+ );
+
+ assert.deepEqual(copyLinksDialog.copyLinks[1], {
+ label: 'Change URL',
+ shortcut: 'u',
+ value: 'http://localhost:9876/review/c/test-project/+/42',
+ });
+ });
});