|
| 1 | +/** |
| 2 | + * Used here only to un-indent multi-line strings, because I refuse to have |
| 3 | + * the description templates strings in here with weird indentations. |
| 4 | + */ |
| 5 | +function trimStartAll(input) { |
| 6 | + return input |
| 7 | + .split("\n") |
| 8 | + .map((l) => l.trimStart()) |
| 9 | + .join("\n"); |
| 10 | +} |
| 11 | + |
| 12 | +/** |
| 13 | + * Builds the default URLSearchParams used to file a new bug and returns it so |
| 14 | + * it can be extended. |
| 15 | + */ |
| 16 | +export function newBugDefaultParams(report) { |
| 17 | + return new URLSearchParams([ |
| 18 | + ["bug_file_loc", report.url], |
| 19 | + ["keywords", "webcompat:site-report"], |
| 20 | + ["op_sys", `${report.os}`], |
| 21 | + ["product", "Web Compatibility"], |
| 22 | + ["rep_platform", "Desktop"], |
| 23 | + ["short_desc", `${new URL(report.url).hostname} - CHANGE_ME`], |
| 24 | + ["status_whiteboard", "[webcompat-source:product]"], |
| 25 | + ["version", `Firefox ${report.app_major_version}`], |
| 26 | + ]); |
| 27 | +} |
| 28 | + |
| 29 | +/** |
| 30 | + * Opens a new tab/window to Bugzilla with a prefilled bug form |
| 31 | + */ |
| 32 | +export function openPrefilledBugzillaBug(searchParams) { |
| 33 | + const url = new URL("https://bugzilla.mozilla.org/enter_bug.cgi"); |
| 34 | + url.search = searchParams.toString(); |
| 35 | + window.open(url.toString(), "_blank"); |
| 36 | +} |
| 37 | + |
| 38 | +/** |
| 39 | + * Generates a pre-filled Bugzilla comment for a Site Report issue |
| 40 | + */ |
| 41 | +export function siteReportDescription(report) { |
| 42 | + return trimStartAll(`**Environment:** |
| 43 | + Operating system: ${report.os} |
| 44 | + Firefox version: ${report.app_name} ${report.app_version} (${report.app_channel}) |
| 45 | +
|
| 46 | + **Preconditions:** |
| 47 | + - Clean profile |
| 48 | +
|
| 49 | + **Steps to reproduce:** |
| 50 | + 1. Navigate to: ${report.url} |
| 51 | + 2. Step 2 |
| 52 | +
|
| 53 | + **Expected Behavior:** |
| 54 | + text |
| 55 | +
|
| 56 | + **Actual Behavior:** |
| 57 | + text |
| 58 | +
|
| 59 | + **Notes:** |
| 60 | + - Reproducible on the latest Firefox Release and Nightly |
| 61 | + - Reproducible regardless of the ETP setting |
| 62 | + - Works as expected using Chrome |
| 63 | +
|
| 64 | + --- |
| 65 | +
|
| 66 | + Created from webcompat-user-report:${report.uuid}`); |
| 67 | +} |
| 68 | + |
| 69 | +/** |
| 70 | + * Generates a pre-filled Bugzilla comment for a ETP Strict compat issue |
| 71 | + */ |
| 72 | +export function etpStrictReportDescription(report) { |
| 73 | + return trimStartAll(`**Environment:** |
| 74 | + Operating system: ${report.os} |
| 75 | + Firefox version: ${report.app_name} ${report.app_version} (${report.app_channel}) |
| 76 | +
|
| 77 | + **Preconditions:** |
| 78 | + - ETP set to STRICT |
| 79 | + - Clean profile |
| 80 | +
|
| 81 | + **Steps to reproduce:** |
| 82 | + 1. Navigate to: ${report.url} |
| 83 | + 2. Step 2 |
| 84 | +
|
| 85 | + **Expected Behavior:** |
| 86 | + text |
| 87 | +
|
| 88 | + **Actual Behavior:** |
| 89 | + text |
| 90 | +
|
| 91 | + **Notes:** |
| 92 | + - Not reproducible with ETP STANDARD/turned OFF (both Normal and Private Browsing) |
| 93 | + - Reproducible on the latest Nightly |
| 94 | +
|
| 95 | + --- |
| 96 | +
|
| 97 | + Created from webcompat-user-report:${report.uuid}`); |
| 98 | +} |
0 commit comments