Support for filing feature requests on extensions, fixes #47508

This commit is contained in:
Rachel Macfarlane 2018-04-13 18:10:57 -07:00
parent efb3aefd99
commit b8df1293c1
3 changed files with 46 additions and 9 deletions

View file

@ -326,7 +326,7 @@ export class IssueReporter extends Disposable {
this.addEventListener('issue-source', 'change', (event: Event) => {
const fileOnExtension = JSON.parse((<HTMLInputElement>event.target).value);
this.issueReporterModel.update({ fileOnExtension: fileOnExtension, includeExtensions: !fileOnExtension, selectedExtension: null });
this.issueReporterModel.update({ fileOnExtension: fileOnExtension, includeExtensions: !fileOnExtension });
this.render();
const title = (<HTMLInputElement>document.getElementById('issue-title')).value;
@ -343,8 +343,7 @@ export class IssueReporter extends Disposable {
this.issueReporterModel.update({ issueDescription });
// Only search for extension issues on title change
const fileOnExtension = this.issueReporterModel.getData().fileOnExtension;
if (!fileOnExtension) {
if (!this.issueReporterModel.fileOnExtension()) {
const title = (<HTMLInputElement>document.getElementById('issue-title')).value;
this.searchVSCodeIssues(title, issueDescription);
}
@ -359,8 +358,7 @@ export class IssueReporter extends Disposable {
hide(lengthValidationMessage);
}
const fileOnExtension = this.issueReporterModel.getData().fileOnExtension;
if (fileOnExtension) {
if (this.issueReporterModel.fileOnExtension()) {
this.searchExtensionIssues(title);
} else {
const description = this.issueReporterModel.getData().issueDescription;
@ -659,7 +657,6 @@ export class IssueReporter extends Disposable {
show(systemBlock);
show(processBlock);
show(workspaceBlock);
show(extensionsBlock);
show(problemSource);
if (fileOnExtension) {
@ -674,6 +671,11 @@ export class IssueReporter extends Disposable {
} else if (issueType === IssueType.FeatureRequest) {
descriptionTitle.innerHTML = `${localize('description', "Description")} <span class="required-input">*</span>`;
descriptionSubtitle.innerHTML = localize('featureRequestDescription', "Please describe the feature you would like to see. We support GitHub-flavored Markdown. You will be able to edit your issue and add screenshots when we preview it on GitHub.");
show(problemSource);
if (fileOnExtension) {
show(extensionSelector);
}
} else if (issueType === IssueType.SettingsSearchIssue) {
show(blockContainer);
show(searchedExtensionsBlock);
@ -701,7 +703,7 @@ export class IssueReporter extends Disposable {
isValid = this.validateInput(elementId) && isValid;
});
if (this.issueReporterModel.getData().fileOnExtension) {
if (this.issueReporterModel.fileOnExtension()) {
isValid = this.validateInput('extension-selector') && isValid;
}
@ -751,7 +753,7 @@ export class IssueReporter extends Disposable {
private getIssueUrlWithTitle(issueTitle: string): string {
let repositoryUrl = product.reportIssueUrl;
if (this.issueReporterModel.getData().fileOnExtension) {
if (this.issueReporterModel.fileOnExtension()) {
const bugsUrl = this.getExtensionBugsUrl();
const extensionUrl = this.getExtensionRepositoryUrl();
// If given, try to match the extension's bug url

View file

@ -73,8 +73,16 @@ ${this.getInfos()}
<!-- generated by issue reporter -->`;
}
fileOnExtension(): boolean {
const fileOnExtensionSupported = this._data.issueType === IssueType.Bug
|| this._data.issueType === IssueType.PerformanceIssue
|| this._data.issueType === IssueType.FeatureRequest;
return fileOnExtensionSupported && this._data.fileOnExtension;
}
private getExtensionVersion(): string {
if (this._data.fileOnExtension) {
if (this.fileOnExtension()) {
return `\nExtension version: ${this._data.selectedExtension.manifest.version}`;
} else {
return '';

View file

@ -8,6 +8,7 @@
import * as assert from 'assert';
import { IssueReporterModel } from 'vs/code/electron-browser/issue/issueReporterModel';
import { normalizeGitHubIssuesUrl } from 'vs/code/electron-browser/issue/issueReporterUtil';
import { IssueType } from 'vs/platform/issue/common/issue';
suite('IssueReporter', () => {
@ -81,4 +82,30 @@ OS version: undefined
assert.equal('https://github.com/repo/issues/new', normalizeGitHubIssuesUrl(url));
});
});
test('should have support for filing on extensions for bugs, performance issues, and feature requests', () => {
[
IssueType.Bug,
IssueType.FeatureRequest,
IssueType.PerformanceIssue
].forEach(type => {
const issueReporterModel = new IssueReporterModel({
issueType: type,
fileOnExtension: true
});
assert.equal(issueReporterModel.fileOnExtension(), true);
});
[
IssueType.SettingsSearchIssue
].forEach(type => {
const issueReporterModel = new IssueReporterModel({
issueType: type,
fileOnExtension: true
});
assert.equal(issueReporterModel.fileOnExtension(), false);
});
});
});