This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b763ca  fix: fix issue checking bug.
4b763ca is described below

commit 4b763caefcba08fb8c2950f163b6ef01ac0181f2
Author: plainheart <[email protected]>
AuthorDate: Thu Nov 26 11:27:15 2020 +0800

    fix: fix issue checking bug.
---
 src/issue.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/issue.js b/src/issue.js
index ce51635..485456e 100644
--- a/src/issue.js
+++ b/src/issue.js
@@ -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;
     }
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to