summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/web/js/new-bug-frequent-comp.js
diff options
context:
space:
mode:
authorKohei Yoshino <kohei.yoshino@gmail.com>2018-10-06 02:21:58 +0200
committerDylan William Hardison <dylan@hardison.net>2018-10-06 02:21:58 +0200
commitb52721090513808901cca1c77a91321d551f7690 (patch)
treea2988d6c02f06e85b88d2ee3db2b25af619c4755 /extensions/BMO/web/js/new-bug-frequent-comp.js
parentbc31fe722c04724cc4fea6e14e042eff0e3d10ed (diff)
downloadbugzilla-b52721090513808901cca1c77a91321d551f7690.tar.gz
bugzilla-b52721090513808901cca1c77a91321d551f7690.tar.xz
Bug 1496803 - Suggested component links ignore cloned bug data
Diffstat (limited to 'extensions/BMO/web/js/new-bug-frequent-comp.js')
-rw-r--r--extensions/BMO/web/js/new-bug-frequent-comp.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/extensions/BMO/web/js/new-bug-frequent-comp.js b/extensions/BMO/web/js/new-bug-frequent-comp.js
index 4ca1fcf89..88879738d 100644
--- a/extensions/BMO/web/js/new-bug-frequent-comp.js
+++ b/extensions/BMO/web/js/new-bug-frequent-comp.js
@@ -36,15 +36,27 @@ Bugzilla.NewBugFrequentComp = class NewBugFrequentComp {
this.$results.setAttribute('aria-busy', 'true');
this.$container.hidden = false;
+ // Get the current params that may contain `cloned_bug_id` and `format`
+ const current_params = new URLSearchParams(location.search);
+
try {
- const results = await this.fetch();
+ const links = (await this.fetch()).map(({ product, component }) => {
+ const params = new URLSearchParams(current_params);
+
+ params.append('product', product);
+ params.append('component', component);
+
+ return {
+ href: `/enter_bug.cgi?${params.toString()}`,
+ text: `${product} :: ${component}`,
+ };
+ });
this.$message.remove();
this.$results.insertAdjacentHTML('beforeend',
- `<ul>${results.map(({ product, component }) => (
- `<li><a href="/enter_bug.cgi?product=${encodeURIComponent(product)}&amp;component=` +
- `${encodeURIComponent(component)}">${product.htmlEncode()} :: ${component.htmlEncode()}</a></li>`
- )).join('')}</ul>`
+ `<ul>${links.map(({ href, text }) =>
+ `<li><a href="${href.htmlEncode()}">${text.htmlEncode()}</a></li>`
+ ).join('')}</ul>`
);
} catch (error) {
this.$message.textContent = error.message || 'Your frequent components could not be retrieved.';