]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1520533 - Utilize Markdown in uplift form comments
authorKohei Yoshino <kohei.yoshino@gmail.com>
Tue, 22 Jan 2019 15:55:27 +0000 (10:55 -0500)
committerDylan William Hardison <dylan@hardison.net>
Tue, 22 Jan 2019 15:55:27 +0000 (10:55 -0500)
extensions/FlagTypeComment/web/js/ftc.js

index d4d6eab00375853caf8ca14dda0287695add3389..84ebda0fe649a4dd1e928d933048515bcce6f942 100644 (file)
@@ -169,9 +169,14 @@ Bugzilla.FlagTypeComment = class FlagTypeComment {
    * @returns {Boolean} Always `true` to allow submitting the form.
    */
   form_onsubmit() {
+    if (this.inserted_fieldsets.length) {
+      // Enable Markdown
+      this.$comment.form.querySelector('[name="markdown_off"]').remove();
+    }
+
     for (const $fieldset of this.inserted_fieldsets) {
       const text = [
-        `[${$fieldset.querySelector('h3').innerText}]`,
+        `## ${$fieldset.querySelector('h3').innerText}`,
         ...[...$fieldset.querySelectorAll('tr')].map($tr => {
           const checkboxes = [...$tr.querySelectorAll('input[type="checkbox"]:checked')];
           const $radio = $tr.querySelector('input[type="radio"]:checked');
@@ -203,7 +208,7 @@ Bugzilla.FlagTypeComment = class FlagTypeComment {
             }
           }
 
-          return `${label}: ${value}`;
+          return `### ${label}\n\n${value}`;
         }),
       ].join('\n\n');