Skip to content
Permalink
Browse files
fix: avoid opening an issue with no template through `Reference in ne…
…w issue`.
  • Loading branch information
plainheart committed Dec 1, 2021
1 parent 6237300 commit f42f9a773c2bb0c81fa9e46a696a10a2df24d0bb
Showing 2 changed files with 15 additions and 6 deletions.
@@ -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.

Copy link
@pissang

pissang Dec 9, 2021

Contributor

@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.

This comment has been minimized.

Copy link
@pissang

pissang Dec 9, 2021

Contributor

I commented in the glitch temporary. Seems currently one thing we need to check is the tittle to avoid issues like apache/echarts#16190

This comment has been minimized.

Copy link
@plainheart

plainheart Dec 9, 2021

Author Member

Seems it's easy to break the bot when issue template is changed like apache/echarts#16196 did.
Perhaps we don't need this check because developers can't create a blank issue without template now.

@pissang I'm sorry for missing this and closing some good issues unexpectedly. But this check is still necessary to prevent the developer from opening an issue via Reference in new issue button, like apache/echarts#16142 apache/echarts#16200.

Because we are new to the GitHub issue template, and recently we found some micro issues/typos in the template and fixed/tweaked them. Now the template is almost perfect and the words and sentences mentioned above won't be changed anymore. Thus this problem won't occur again.

Seems currently one thing we need to check is the tittle to avoid issues like apache/echarts#16190

Several days ago, I noticed the case and started to solve it. This job has been done but I didn't commit the changes and make it work in fact. If you think this check is needed, we can enable it later.

}
}

module.exports = Issue;
@@ -1,15 +1,13 @@
const NOT_USING_TEMPLATE =
`This issue is not created using [issue template](https://ecomfe.github.io/echarts-issue-helper/) so I'm going to close it. 🙊
`This issue is not created using [issue template](https://github.com/apache/echarts/issues/new/choose) so I'm going to close it. 🙊
Sorry for this, but it helps save our maintainers' time so that more developers get helped.
Feel free to create another issue using the issue template.
If you think you have already made your point clear without the template, or your problem cannot be covered by it, you may re-open this issue again.
这个 issue 未使用 [issue 模板](https://ecomfe.github.io/echarts-issue-helper/?lang=zh-cn) 创建,所以我将关闭此 issue。
这个 issue 未使用 [issue 模板](https://github.com/apache/echarts/issues/new/choose) 创建,所以我将关闭此 issue。
为此带来的麻烦我深表歉意,但是请理解这是为了节约社区维护者的时间,以更高效地服务社区的开发者群体。
如果您愿意,请使用 issue 模板重新创建 issue。
如果您认为虽然没有使用模板,但您已经提供了复现问题的充分描述,或者您的问题无法使用模板表达,也可以重新 open 这个 issue。`;
如果您愿意,请使用 issue 模板重新创建 issue。`;

const ISSUE_CREATED =
`Hi! We've received your issue and please be patient to get responded. 🎉
@@ -82,7 +80,7 @@ For (1), we have decided to use the GitHub issue lists exclusively for work that
For (2), we have found that issues that do not provide proper information upfront usually results in terribly inefficient back-and-forth communication just to extract the basic information needed for actual triaging. This is exactly why we have created this app: to ensure that every issue is created with the necessary information, and to save time on both sides.`;

const ISSUE_COMMENT_TRANSLATE_TIP = 'AT_ISSUE_AUTHOR It seems you are not using English, I\'ve helped translate the content automatically. To make your issue understood by more people, we\'d like to suggest using English next time. 🤗';
const ISSUE_COMMENT_TRANSLATE_TIP = 'AT_ISSUE_AUTHOR It seems you are not using English, I\'ve helped translate the content automatically. To make your issue understood by more people and get helped, we\'d like to suggest using English next time. 🤗';

module.exports = {
NOT_USING_TEMPLATE,

0 comments on commit f42f9a7

Please sign in to comment.