This is an automated email from the ASF dual-hosted git repository.
kumfo pushed a commit to branch feat/reviewer-basic
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git
The following commit(s) were added to refs/heads/feat/reviewer-basic by this
push:
new d3c9675 feat(review): Improve basic review plugin
d3c9675 is described below
commit d3c9675358f9390fa054fb252332c9177d1e52a1
Author: kumfo <[email protected]>
AuthorDate: Tue Apr 16 14:45:21 2024 +0800
feat(review): Improve basic review plugin
---
reviewer-basic/basic.go | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/reviewer-basic/basic.go b/reviewer-basic/basic.go
index 69a63c1..ee9064d 100644
--- a/reviewer-basic/basic.go
+++ b/reviewer-basic/basic.go
@@ -60,7 +60,12 @@ func (r *Reviewer) Info() plugin.Info {
func (r *Reviewer) Review(content *plugin.ReviewContent) (result
*plugin.ReviewResult) {
result = &plugin.ReviewResult{Approved: true, ReviewStatus:
plugin.ReviewStatusApproved}
// this switch is true and have any other approved post, return directly
- if r.Config.PostNeedReview &&
content.Author.ApprovedQuestionAmount+content.Author.ApprovedAnswerAmount > 1 {
+ if r.Config.PostNeedReview &&
content.Author.ApprovedQuestionAmount+content.Author.ApprovedAnswerAmount == 0 {
+ result = &plugin.ReviewResult{
+ Approved: false,
+ ReviewStatus: plugin.ReviewStatusNeedReview,
+ Reason:
fmt.Sprintf(plugin.TranslateWithData(myI18n.Language(content.Language),
i18n.CommentMatchWordReview, nil), keyword),
+ }
return result
}
// If the author is admin, no need to review