Merge branch 'feat/1.3.0/review' into test

This commit is contained in:
LinkinStars
2024-03-15 17:31:58 +08:00
3 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -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)
@@ -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.TagCommonService
externalNotificationQueueService notice_queue.ExternalNotificationQueueService
notificationQueueService 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, objectI
ReviewerUserID: "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 approved
+3
View File
@@ -17,6 +17,9 @@ type ReviewContent struct {
Tags []string
// The author of the content
Author 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 {