Skip to content
Permalink
Browse files
fix: fix issue checking bug.
  • Loading branch information
plainheart committed Nov 26, 2020
1 parent d358cb6 commit 4b763caefcba08fb8c2950f163b6ef01ac0181f2
Showing 1 changed file with 8 additions and 2 deletions.
@@ -8,6 +8,7 @@ class Issue {
constructor(context) {
this.context = context;
this.issue = context.payload.issue;
this.title = this.issue.title;
this.body = this.issue.body;
this.issueType = null;
this.addLabels = [];
@@ -70,8 +71,13 @@ class Issue {
}

_isMainlyUsingChinese() {
return this.title.match(REG_CHN_CHAR).length > MAX_CHN_CHAR_COUNT
|| this.body.match(REG_CHN_CHAR).length > MAX_CHN_CHAR_COUNT;
const titleMatch = this.title.match(REG_CHN_CHAR);
// if title is mainly using Chinese, no need to check body
if (titleMatch && titleMatch.length > MAX_CHN_CHAR_COUNT) {
return true;
}
const bodyMatch = this.body.match(REG_CHN_CHAR);
return bodyMatch && bodyMatch.length > MAX_CHN_CHAR_COUNT;
}
}

0 comments on commit 4b763ca

Please sign in to comment.