Skip to content

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): add url title for review page

LinkinStars34660ee161d5
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,