Skip to content

Commit

Permalink
Report specific filter issue through a template
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 12, 2021
1 parent dea7184 commit e1c3865
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
36 changes: 6 additions & 30 deletions src/js/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,36 +183,12 @@ function reportSpecificFilterType() {
}

function reportSpecificFilterIssue(ev) {
const bodyTemplate = [
'## Address of the web page',
'',
'`{{url}}`',
'',
'## Type of issue',
'',
'{{type}}',
'',
'## Description (when issue is not obvious)',
'',
'[none]',
'',
'## Screenshot (when description is difficult)',
'',
'[none]',
'',
'## Configuration',
'',
'{{configuration}}',
].join('\n');
const githubURL = new URL('https:/uBlockOrigin/uAssets/issues/new');
const issueType = document.querySelector('[data-i18n="supportS6Select1"] ~ select').value;
const title = `${reportSpecificFilterHostname()}: ${reportSpecificFilterType()}`;
const body = bodyTemplate
.replace('{{url}}', reportURL.href)
.replace('{{type}}', issueType)
.replace('{{configuration}}', configToMarkdown(false));
githubURL.searchParams.set('title', title);
githubURL.searchParams.set('body', body);
const githubURL = new URL('https:/uBlockOrigin/uAssets/issues/new?template=specific_report_from_ubo.yml');
const issueType = reportSpecificFilterType();
githubURL.searchParams.set('title', `${reportSpecificFilterHostname()}: ${issueType}`);
githubURL.searchParams.set('url_address_of_the_web_page', '`' + reportURL.href + '`');
githubURL.searchParams.set('category', issueType);
githubURL.searchParams.set('configuration', configToMarkdown(false));
vAPI.messaging.send('default', {
what: 'gotoURL',
details: { url: githubURL.href, select: true, index: -1 },
Expand Down
2 changes: 1 addition & 1 deletion src/support.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h3 data-i18n="supportS3H"></h3>
<p data-i18n="supportS3P3">
</div>
<div>
<button id="filterReport" type="button" data-url="https:/uBlockOrigin/uAssets/issues/new?template=bug_report_from_ubo.yml" data-i18n="supportOpenButton"></button>
<button id="filterReport" type="button" data-url="https:/uBlockOrigin/uAssets/issues/new?template=report_from_ubo.yml" data-i18n="supportOpenButton"></button>
</div>
</div>
<hr>
Expand Down

0 comments on commit e1c3865

Please sign in to comment.