A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
feat(plugin): add language for review plugin
LinkinStarsc25dad69b043
diff --git a/cmd/wire_gen.go b/cmd/wire_gen.goindex a06d93eb..816d05f2 100644--- a/cmd/wire_gen.go+++ b/cmd/wire_gen.go@@ -172,7 +172,7 @@ func initApplication(debug bool, serverConf *conf.Server, dbConf *data.Database,answerActivityService := activity2.NewAnswerActivityService(answerActivityRepo, configService)externalNotificationService := notification.NewExternalNotificationService(dataData, userNotificationConfigRepo, followRepo, emailService, userRepo, externalNotificationQueueService, userExternalLoginRepo, siteInfoCommonService)reviewRepo := review.NewReviewRepo(dataData)- reviewService := review2.NewReviewService(reviewRepo, objService, userCommon, userRepo, questionRepo, answerRepo, userRoleRelService, externalNotificationQueueService, tagCommonService, notificationQueueService)+ reviewService := review2.NewReviewService(reviewRepo, objService, userCommon, userRepo, questionRepo, answerRepo, userRoleRelService, externalNotificationQueueService, tagCommonService, notificationQueueService, siteInfoCommonService)questionService := content.NewQuestionService(questionRepo, tagCommonService, questionCommon, userCommon, userRepo, userRoleRelService, revisionService, metaService, collectionCommon, answerActivityService, emailService, notificationQueueService, externalNotificationQueueService, activityQueueService, siteInfoCommonService, externalNotificationService, reviewService)answerService := content.NewAnswerService(answerRepo, questionRepo, questionCommon, userCommon, collectionCommon, userRepo, revisionService, answerActivityService, answerCommon, voteRepo, emailService, userRoleRelService, notificationQueueService, externalNotificationQueueService, activityQueueService, reviewService)reportHandle := report_handle.NewReportHandle(questionService, answerService, commentService)diff --git a/internal/service/review/review_service.go b/internal/service/review/review_service.goindex 2cd49997..80c318b1 100644--- a/internal/service/review/review_service.go+++ b/internal/service/review/review_service.go@@ -32,6 +32,7 @@ import ("github.com/apache/incubator-answer/internal/service/object_info"questioncommon "github.com/apache/incubator-answer/internal/service/question_common""github.com/apache/incubator-answer/internal/service/role"+ "github.com/apache/incubator-answer/internal/service/siteinfo_common"tagcommon "github.com/apache/incubator-answer/internal/service/tag_common"usercommon "github.com/apache/incubator-answer/internal/service/user_common""github.com/apache/incubator-answer/pkg/htmltext"@@ -64,6 +65,7 @@ type ReviewService struct {tagCommon *tagcommon.TagCommonServiceexternalNotificationQueueService notice_queue.ExternalNotificationQueueServicenotificationQueueService notice_queue.NotificationQueueService+ siteInfoService siteinfo_common.SiteInfoCommonService}// NewReviewService new review service@@ -78,6 +80,7 @@ func NewReviewService(externalNotificationQueueService notice_queue.ExternalNotificationQueueService,tagCommon *tagcommon.TagCommonService,notificationQueueService notice_queue.NotificationQueueService,+ siteInfoService siteinfo_common.SiteInfoCommonService,) *ReviewService {return &ReviewService{reviewRepo: reviewRepo,@@ -90,6 +93,7 @@ func NewReviewService(externalNotificationQueueService: externalNotificationQueueService,tagCommon: tagCommon,notificationQueueService: notificationQueueService,+ siteInfoService: siteInfoService,}}@@ -151,6 +155,9 @@ func (cs *ReviewService) callPluginToReview(ctx context.Context, userID, objectIReviewerUserID: "0",Status: entity.ReviewStatusPending,}+ if siteInterface, _ := cs.siteInfoService.GetSiteInterface(ctx); siteInterface != nil {+ reviewContent.Language = siteInterface.Language+ }_ = plugin.CallReviewer(func(reviewer plugin.Reviewer) error {// If one of the reviewer plugin return false, then the review is not approveddiff --git a/plugin/reviewer.go b/plugin/reviewer.goindex f109b146..95569d39 100644--- a/plugin/reviewer.go+++ b/plugin/reviewer.go@@ -17,6 +17,9 @@ type ReviewContent struct {Tags []string// The author of the contentAuthor ReviewContentAuthor+ // Review Language, the site language. e.g. en_US+ // The plugin may reply the review result according to the language+ Language string}type ReviewContentAuthor struct {