You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2020/10/28 03:00:28 UTC
[incubator-echarts-bot] branch master updated: fix: fix the logic
of `isCommiter`.
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 ea208de fix: fix the logic of `isCommiter`.
ea208de is described below
commit ea208debfd5f3dc12309924895119287a800147e
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Wed Oct 28 10:54:09 2020 +0800
fix: fix the logic of `isCommiter`.
---
index.js | 15 +++++++--------
src/coreCommitters.js | 7 ++++++-
src/issue.js | 5 ++++-
src/text.js | 4 ++--
4 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/index.js b/index.js
index f9e2462..e5af947 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,6 @@
const Issue = require('./src/issue');
const text = require('./src/text');
-const { isCoreCommitter } = require('./src/coreCommitters');
+const { isCommitter } = require('./src/coreCommitters');
module.exports = app => {
app.on(['issues.opened'], async context => {
@@ -74,7 +74,7 @@ module.exports = app => {
const isCommenterAuthor = commenter === context.payload.issue.user.login;
let removeLabel;
let addLabel;
- if (isCoreCommitter(commenter)) {
+ if (isCommitter(context.payload.comment.author_association, commenter) && !isCommenterAuthor) {
// New comment from core committers
removeLabel = getRemoveLabel(context, 'waiting-for: community');
}
@@ -89,7 +89,10 @@ module.exports = app => {
});
app.on(['pull_request.opened'], async context => {
- const isCore = isCoreCommitter(context.payload.pull_request.user.login);
+ const isCore = isCommitter(
+ context.payload.pull_request.author_association,
+ context.payload.pull_request.user.login
+ );
let commentText = isCore
? text.PR_OPENED_BY_COMMITTER
: text.PR_OPENED;
@@ -152,7 +155,7 @@ module.exports = app => {
app.on(['pull_request_review.submitted'], async context => {
if (context.payload.review.state === 'changes_requested'
- && isCoreCommitter(context.payload.review.user.login)
+ && isCommitter(context.payload.review.author_association, context.payload.review.user.login)
) {
const addLabel = context.github.issues.addLabels(context.issue({
labels: ['PR: revision needed']
@@ -194,7 +197,3 @@ function commentIssue(context, commentText) {
function replaceAll(str, search, replacement) {
return str.replace(new RegExp(search, 'g'), replacement);
}
-
-function isCommitter(auth) {
- return auth === 'COLLABORATOR' || auth === 'MEMBER' || auth === 'OWNER';
-}
diff --git a/src/coreCommitters.js b/src/coreCommitters.js
index 75dcc9a..7520cb8 100644
--- a/src/coreCommitters.js
+++ b/src/coreCommitters.js
@@ -23,7 +23,12 @@ function isCoreCommitter(user) {
return committers.indexOf(user) > -1;
}
+function isCommitter(auth, user) {
+ return auth === 'COLLABORATOR' || auth === 'MEMBER' || auth === 'OWNER' || isCoreCommitter(user);
+}
+
module.exports = {
getCoreCommitters,
- isCoreCommitter
+ isCoreCommitter,
+ isCommitter
};
diff --git a/src/issue.js b/src/issue.js
index 3fa2d98..efcbe60 100644
--- a/src/issue.js
+++ b/src/issue.js
@@ -1,4 +1,5 @@
const text = require('./text');
+const { isCommitter } = require('./coreCommitters');
class Issue {
constructor(context) {
@@ -9,7 +10,9 @@ class Issue {
this.addLabels = [];
this.removeLabel = null;
- if (this.isUsingTemplate()) {
+ // if author is committer, do not check if using template
+ const isCore = isCommitter(this.issue.author_association, this.issue.user.login);
+ if (isCore || this.isUsingTemplate()) {
this.init();
}
else {
diff --git a/src/text.js b/src/text.js
index 8febc54..343b194 100644
--- a/src/text.js
+++ b/src/text.js
@@ -12,12 +12,12 @@ If you think you have already made your point clear without the template, or you
如果您认为虽然没有使用模板,但您已经提供了复现问题的充分描述,或者您的问题无法使用模板表达,也可以重新 open 这个 issue。`;
const ISSUE_CREATED =
- `Hi! We\'ve received your issue and please be patient to get responded. 🎉
+ `Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that **you have posted enough image to demo your request**. You may also check out the [API](http://echarts.apache.org/api.html) and [chart option](http://echarts.apache.org/option.html) to get the answer.
-If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical questions.
+If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.
If you are interested in the project, you may also subscribe our [mailing list](https://echarts.apache.org/en/maillist.html).
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org