Skip to content

Commit 7e45ed6

Browse files
committed
Port currently-in-use prefilled Bugzilla links over.
After talking to our triage heroes, I decided against using the built-in Bugzilla filing mechanism - for now. The reasons are: - They set the version tracking fields for the reports they file. This isn't impossible to add, but the current implementation that fetches the Bugzilla products and components ([0]) is already quite complicated. I could get the currently tracked versions over the API, but that'd be quite a bit of work. - They sometimes also edit other fields, if there's a need. I could add all the fields to the built-in form, but at that point, I'd be kinda duplicating Bugzilla's UI. However, this implementation is not perfect. - The theoritical issue where the field lengths could exceed the available length for the URL is still there. We didn't run into that so far, so I think that's fine to ignore for now. - We have one button to file a bug for the entire bucket, but we need some per-bug data. For now, I'm mirroring what the old file button did and just using the first shown report as the source. Ideally, we'd move the button into the table below, but this is already super cramped. I might have a UI+UX pass in the future, but that's more like a P2. - This has no test coverage. That being said, the JS-side of things already has only ~44% of coverage, so this isn't a huge deal. We should fix that, eventually. [0]: https://github.com/MozillaSecurity/WebCompatManager/blob/6093a404de2e9ab310a99e116bccf68eb7d64cd8/server/frontend/src/components/Bugs/ProductComponentSelect.vue#L130
1 parent 0bcd431 commit 7e45ed6

2 files changed

Lines changed: 132 additions & 3 deletions

File tree

server/frontend/src/components/Buckets/View.vue

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
<br v-if="canEdit" /><br v-if="canEdit" />
3939
<div v-if="canEdit" class="btn-group">
4040
<assignbutton :bucket="bucket.id" :providers="providers" />
41-
<a :href="bucket.new_bug_url" class="btn btn-danger"
42-
>File a bug</a
43-
>
4441
<hidebucketbutton
4542
v-if="!bucket.hide_until"
4643
:bucket="bucket.id"
@@ -49,6 +46,21 @@
4946
>Unmark triaged</a
5047
>
5148
</div>
49+
<br v-if="canEdit" /><br v-if="canEdit" />
50+
<div v-if="canEdit" class="btn-group">
51+
<a
52+
class="btn btn-success"
53+
v-on:click="prepareSiteReport(reports)"
54+
>
55+
Prepare new Site Report bug
56+
</a>
57+
<a
58+
class="btn btn-success"
59+
v-on:click="prepareETPStrictReport(reports)"
60+
>
61+
Prepare new ETP Strict bug
62+
</a>
63+
</div>
5264
</td>
5365
</tr>
5466
<tr>
@@ -209,6 +221,12 @@ import {
209221
jsonPretty,
210222
parseHash,
211223
} from "../../helpers";
224+
import {
225+
etpStrictReportDescription,
226+
newBugDefaultParams,
227+
openPrefilledBugzillaBug,
228+
siteReportDescription,
229+
} from "../../prefilled_bug_helpers";
212230
import * as api from "../../api";
213231
import PageNav from "../PageNav.vue";
214232
import ActivityGraph from "../ActivityGraph.vue";
@@ -435,6 +453,19 @@ export default {
435453
url.search = searchParams.toString();
436454
return url.toString();
437455
},
456+
prepareSiteReport(reports) {
457+
const searchParams = newBugDefaultParams(reports[0]);
458+
searchParams.append("component", "Site Reports");
459+
searchParams.append("comment", siteReportDescription(reports[0]));
460+
openPrefilledBugzillaBug(searchParams);
461+
},
462+
prepareETPStrictReport(reports) {
463+
const searchParams = newBugDefaultParams(reports[0]);
464+
searchParams.append("component", "Privacy: Site Reports");
465+
searchParams.append("comment", etpStrictReportDescription(reports[0]));
466+
searchParams.append("dependson", "tp-breakage");
467+
openPrefilledBugzillaBug(searchParams);
468+
},
438469
},
439470
watch: {
440471
currentPage() {
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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

Comments
 (0)