From 34660ee161d54cdb11f4655b77aa74c920602aff Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Fri, 15 Mar 2024 16:26:51 +0800 Subject: [PATCH] feat(review): add url title for review page --- internal/schema/report_schema.go | 1 + internal/schema/review_schema.go | 1 + internal/service/report/report_service.go | 2 ++ internal/service/review/review_service.go | 2 ++ 4 files changed, 6 insertions(+) diff --git a/internal/schema/report_schema.go b/internal/schema/report_schema.go index b80e7c26..233ac058 100644 --- a/internal/schema/report_schema.go +++ b/internal/schema/report_schema.go @@ -79,6 +79,7 @@ type GetReportListPageResp struct { CommentID string `json:"comment_id"` ObjectType string `json:"object_type" enums:"question,answer,comment"` Title string `json:"title"` + UrlTitle string `json:"url_title"` OriginalText string `json:"original_text"` AnswerCount int `json:"answer_count"` AnswerAccepted bool `json:"answer_accepted"` diff --git a/internal/schema/review_schema.go b/internal/schema/review_schema.go index 556e4df3..d9a78624 100644 --- a/internal/schema/review_schema.go +++ b/internal/schema/review_schema.go @@ -48,6 +48,7 @@ type GetUnreviewedPostPageResp struct { CommentID string `json:"comment_id"` ObjectType string `json:"object_type" enums:"question,answer,comment"` Title string `json:"title"` + UrlTitle string `json:"url_title"` OriginalText string `json:"original_text"` Tags []*TagResp `json:"tags"` ObjectStatus int `json:"object_status"` diff --git a/internal/service/report/report_service.go b/internal/service/report/report_service.go index 8b9d28f7..e91217e9 100644 --- a/internal/service/report/report_service.go +++ b/internal/service/report/report_service.go @@ -36,6 +36,7 @@ import ( "github.com/apache/incubator-answer/internal/service/report_common" "github.com/apache/incubator-answer/internal/service/report_handle" usercommon "github.com/apache/incubator-answer/internal/service/user_common" + "github.com/apache/incubator-answer/pkg/htmltext" "github.com/apache/incubator-answer/pkg/obj" "github.com/jinzhu/copier" "github.com/segmentfault/pacman/errors" @@ -136,6 +137,7 @@ func (rs *ReportService) GetUnreviewedReportPostPage(ctx context.Context, req *s AnswerID: info.AnswerID, CommentID: info.CommentID, Title: info.Title, + UrlTitle: htmltext.UrlTitle(info.Title), OriginalText: info.Content, AnswerCount: info.AnswerCount, AnswerAccepted: info.AnswerAccepted, diff --git a/internal/service/review/review_service.go b/internal/service/review/review_service.go index 788de64c..1c235a1a 100644 --- a/internal/service/review/review_service.go +++ b/internal/service/review/review_service.go @@ -34,6 +34,7 @@ import ( "github.com/apache/incubator-answer/internal/service/role" 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" "github.com/apache/incubator-answer/pkg/token" "github.com/apache/incubator-answer/pkg/uid" "github.com/apache/incubator-answer/plugin" @@ -357,6 +358,7 @@ func (cs *ReviewService) GetUnreviewedPostPage(ctx context.Context, req *schema. CommentID: info.CommentID, ObjectType: info.ObjectType, Title: info.Title, + UrlTitle: htmltext.UrlTitle(info.Title), OriginalText: info.Content, Tags: info.Tags, ObjectStatus: info.Status,