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(review): update review report request flag id
LinkinStars6736a711cb44
diff --git a/docs/docs.go b/docs/docs.goindex 6f19753b..6f690389 100644--- a/docs/docs.go+++ b/docs/docs.go@@ -7822,6 +7822,9 @@ const docTemplate = `{"schema.GetReportListPageResp": {"type": "object","properties": {+ "answer_accepted": {+ "type": "boolean"+ },"answer_count": {"type": "integer"},@@ -8878,8 +8881,8 @@ const docTemplate = `{"schema.ReviewReportReq": {"type": "object","required": [- "operation_type",- "report_id"+ "flag_id",+ "operation_type"],"properties": {"close_msg": {@@ -8893,6 +8896,9 @@ const docTemplate = `{"maxLength": 65535,"minLength": 6},+ "flag_id": {+ "type": "string"+ },"operation_type": {"type": "string","enum": [@@ -8903,9 +8909,6 @@ const docTemplate = `{"ignore_report"]},- "report_id": {- "type": "string"- },"tags": {"type": "array","items": {@@ -9639,6 +9642,9 @@ const docTemplate = `{"schema.UnreviewedRevisionInfoInfo": {"type": "object","properties": {+ "answer_accepted": {+ "type": "boolean"+ },"answer_count": {"type": "integer"},diff --git a/docs/swagger.json b/docs/swagger.jsonindex dab51960..d227bfef 100644--- a/docs/swagger.json+++ b/docs/swagger.json@@ -7810,6 +7810,9 @@"schema.GetReportListPageResp": {"type": "object","properties": {+ "answer_accepted": {+ "type": "boolean"+ },"answer_count": {"type": "integer"},@@ -8866,8 +8869,8 @@"schema.ReviewReportReq": {"type": "object","required": [- "operation_type",- "report_id"+ "flag_id",+ "operation_type"],"properties": {"close_msg": {@@ -8881,6 +8884,9 @@"maxLength": 65535,"minLength": 6},+ "flag_id": {+ "type": "string"+ },"operation_type": {"type": "string","enum": [@@ -8891,9 +8897,6 @@"ignore_report"]},- "report_id": {- "type": "string"- },"tags": {"type": "array","items": {@@ -9627,6 +9630,9 @@"schema.UnreviewedRevisionInfoInfo": {"type": "object","properties": {+ "answer_accepted": {+ "type": "boolean"+ },"answer_count": {"type": "integer"},diff --git a/docs/swagger.yaml b/docs/swagger.yamlindex 5a8de316..d2e2c041 100644--- a/docs/swagger.yaml+++ b/docs/swagger.yaml@@ -821,6 +821,8 @@ definitions:type: objectschema.GetReportListPageResp:properties:+ answer_accepted:+ type: booleananswer_count:type: integeranswer_id:@@ -1558,6 +1560,8 @@ definitions:maxLength: 65535minLength: 6type: string+ flag_id:+ type: stringoperation_type:enum:- edit_post@@ -1566,8 +1570,6 @@ definitions:- unlist_post- ignore_reporttype: string- report_id:- type: stringtags:items:$ref: '#/definitions/schema.TagItem'@@ -1577,8 +1579,8 @@ definitions:minLength: 6type: stringrequired:+ - flag_id- operation_type- - report_idtype: objectschema.RevisionAuditReq:properties:@@ -2071,6 +2073,8 @@ definitions:type: objectschema.UnreviewedRevisionInfoInfo:properties:+ answer_accepted:+ type: booleananswer_count:type: integeranswer_id:diff --git a/internal/schema/report_schema.go b/internal/schema/report_schema.goindex eadcde84..908e0451 100644--- a/internal/schema/report_schema.go+++ b/internal/schema/report_schema.go@@ -81,6 +81,7 @@ type GetReportListPageResp struct {Title string `json:"title"`OriginalText string `json:"original_text"`AnswerCount int `json:"answer_count"`+ AnswerAccepted bool `json:"answer_accepted"`Tags []*TagResp `json:"tags"`ObjectStatus int `json:"object_status"`ObjectShowStatus int `json:"object_show_status"`@@ -97,7 +98,7 @@ type GetUnreviewedReportPostPageReq struct {// ReviewReportReq review report requesttype ReviewReportReq struct {- ReportID string `validate:"required" json:"report_id"`+ FlagID string `validate:"required" json:"flag_id"`OperationType string `validate:"required,oneof=edit_post close_post delete_post unlist_post ignore_report" json:"operation_type"`CloseType int `validate:"omitempty" json:"close_type"`CloseMsg string `validate:"omitempty" json:"close_msg"`diff --git a/internal/schema/simple_obj_info_schema.go b/internal/schema/simple_obj_info_schema.goindex ffd5b97b..9dbf0d79 100644--- a/internal/schema/simple_obj_info_schema.go+++ b/internal/schema/simple_obj_info_schema.go@@ -45,6 +45,7 @@ type UnreviewedRevisionInfoInfo struct {Content string `json:"content"`Html string `json:"html"`AnswerCount int `json:"answer_count"`+ AnswerAccepted bool `json:"answer_accepted"`Tags []*TagResp `json:"tags"`Status int `json:"status"`ShowStatus int `json:"show_status"`diff --git a/internal/service/object_info/object_info.go b/internal/service/object_info/object_info.goindex 9369c425..e20d24b7 100644--- a/internal/service/object_info/object_info.go+++ b/internal/service/object_info/object_info.go@@ -30,6 +30,7 @@ import ("github.com/apache/incubator-answer/internal/service/comment_common"questioncommon "github.com/apache/incubator-answer/internal/service/question_common"tagcommon "github.com/apache/incubator-answer/internal/service/tag_common"+ "github.com/apache/incubator-answer/pkg/checker""github.com/apache/incubator-answer/pkg/obj""github.com/apache/incubator-answer/pkg/uid""github.com/segmentfault/pacman/errors"@@ -96,6 +97,7 @@ func (os *ObjService) GetUnreviewedRevisionInfo(ctx context.Context, objectID stContent: questionInfo.OriginalText,Html: questionInfo.ParsedText,AnswerCount: questionInfo.AnswerCount,+ AnswerAccepted: !checker.IsNotZeroString(questionInfo.AcceptedAnswerID),Tags: tags,Status: questionInfo.Status,ShowStatus: questionInfo.Show,@@ -130,6 +132,7 @@ func (os *ObjService) GetUnreviewedRevisionInfo(ctx context.Context, objectID stContent: answerInfo.OriginalText,Html: answerInfo.ParsedText,Status: answerInfo.Status,+ AnswerAccepted: questionInfo.AcceptedAnswerID == answerInfo.ID,}case constant.TagObjectType:tagInfo, exist, err := os.tagRepo.GetTagByID(ctx, objectID, true)diff --git a/internal/service/report/report_service.go b/internal/service/report/report_service.goindex 0d82aa77..b59e762f 100644--- a/internal/service/report/report_service.go+++ b/internal/service/report/report_service.go@@ -135,6 +135,7 @@ func (rs *ReportService) GetUnreviewedReportPostPage(ctx context.Context, req *sTitle: info.Title,OriginalText: info.Content,AnswerCount: info.AnswerCount,+ AnswerAccepted: info.AnswerAccepted,Tags: info.Tags,SubmitAt: report.CreatedAt.Unix(),ObjectStatus: info.Status,@@ -176,7 +177,7 @@ func (rs *ReportService) GetUnreviewedReportPostPage(ctx context.Context, req *s// ReviewReport review reportfunc (rs *ReportService) ReviewReport(ctx context.Context, req *schema.ReviewReportReq) (err error) {- report, exist, err := rs.reportRepo.GetByID(ctx, req.ReportID)+ report, exist, err := rs.reportRepo.GetByID(ctx, req.FlagID)if err != nil {return err}diff --git a/plugin/reviewer.go b/plugin/reviewer.goindex b3dc8abb..f109b146 100644--- a/plugin/reviewer.go+++ b/plugin/reviewer.go@@ -9,9 +9,12 @@ type Reviewer interface {type ReviewContent struct {// The type of the content, e.g. question, answerObjectType string- Title string- Content string- Tags []string+ // The title of the content, only available for the question+ Title string+ // The content of the review, always available+ Content string+ // The tags of the content, only available for the question+ Tags []string// The author of the contentAuthor ReviewContentAuthor}@@ -19,9 +22,10 @@ type ReviewContent struct {type ReviewContentAuthor struct {// The user's reputationRank int- // The amount of questions and answers that the user has approved+ // The amount of questions that has approvedApprovedQuestionAmount int64- ApprovedAnswerAmount int64+ // The amount of answers that has approved+ ApprovedAnswerAmount int64// 1:User 2:Admin 3:ModeratorRole int}