…w issue`.
- Loading branch information
There are no files selected for viewing
@@ -15,13 +15,19 @@ class Issue { | ||
this.translatedBody = null; | ||
this.addLabels = []; | ||
this.removeLabel = null; | ||
this.response = null; | ||
} | ||
|
||
async init () { | ||
// if author is committer, do not check if using template | ||
const isCore = isCommitter(this.issue.author_association, this.issue.user.login); | ||
|
||
if (!isCore) { | ||
// avoid opening an issue with no template through `Reference in new issue` | ||
if (!this.isUsingTemplate()) { | ||
this.addLabels.push(label.INVALID); | ||
return; | ||
} | ||
this.addLabels.push(label.PENDING); | ||
this.addLabels.push(label.WAITING_FOR_COMMUNITY); | ||
} | ||
@@ -47,6 +53,11 @@ class Issue { | ||
this.translatedBody = res.lang !== 'en' && [res.translated, res.lang]; | ||
} | ||
} | ||
|
||
isUsingTemplate() { | ||
return this.body.indexOf('Steps To Reproduce') > -1 | ||
|| this.body.indexOf('What problem does this feature solve') > - 1; | ||
This comment has been minimized.
This comment has been minimized.
pissang
Contributor
|
||
} | ||
} | ||
|
||
module.exports = Issue; |
@plainheart Seems it's easy to break the bot when issue template is changed like apache/echarts#16196 did. e.g. apache/echarts#16197 is closed unexpectedly.
Perhaps we don't need this check because developers can't create a blank issue without template now.