Skip to content
Permalink
Browse files
fix: fix the logic of isCommiter.
  • Loading branch information
plainheart committed Oct 28, 2020
1 parent ae18cd0 commit ea208debfd5f3dc12309924895119287a800147e
Showing 4 changed files with 19 additions and 12 deletions.
@@ -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';
}
@@ -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
};
@@ -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 {
@@ -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).

0 comments on commit ea208de

Please sign in to comment.