]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1496803 - Suggested component links ignore cloned bug data
authorKohei Yoshino <kohei.yoshino@gmail.com>
Sat, 6 Oct 2018 00:21:58 +0000 (20:21 -0400)
committerDylan William Hardison <dylan@hardison.net>
Sat, 6 Oct 2018 00:21:58 +0000 (20:21 -0400)
extensions/BMO/web/js/new-bug-frequent-comp.js

index 4ca1fcf893e88ae8629966f37fb0eb7c9a60e050..88879738dc91fb68660a976c247335f89b1a5dbc 100644 (file)
@@ -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.';