You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2024/03/15 08:27:00 UTC

(incubator-answer) branch feat/1.3.0/review updated: feat(review): add url title for review page

This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch feat/1.3.0/review
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git


The following commit(s) were added to refs/heads/feat/1.3.0/review by this push:
     new 34660ee1 feat(review): add url title for review page
34660ee1 is described below

commit 34660ee161d54cdb11f4655b77aa74c920602aff
Author: LinkinStars <li...@foxmail.com>
AuthorDate: Fri Mar 15 16:26:51 2024 +0800

    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,