mirror of https://gitee.com/answerdev/answer.git
add question and tags Description
This commit is contained in:
parent
054f7b5c9a
commit
d8682e7264
|
@ -97,6 +97,7 @@ type QuestionInfo struct {
|
|||
Title string `json:"title" xorm:"title"` // title
|
||||
Content string `json:"content" xorm:"content"` // content
|
||||
HTML string `json:"html" xorm:"html"` // html
|
||||
Description string `json:"description"` //description
|
||||
Tags []*TagResp `json:"tags" ` // tags
|
||||
ViewCount int `json:"view_count" xorm:"view_count"` // view_count
|
||||
UniqueViewCount int `json:"unique_view_count" xorm:"unique_view_count"` // unique_view_count
|
||||
|
|
|
@ -66,6 +66,8 @@ type GetTagResp struct {
|
|||
OriginalText string `json:"original_text"`
|
||||
// parsed text
|
||||
ParsedText string `json:"parsed_text"`
|
||||
// description text
|
||||
Description string `json:"description"`
|
||||
// follower amount
|
||||
FollowCount int `json:"follow_count"`
|
||||
// question amount
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
"github.com/answerdev/answer/internal/service/revision_common"
|
||||
tagcommon "github.com/answerdev/answer/internal/service/tag_common"
|
||||
usercommon "github.com/answerdev/answer/internal/service/user_common"
|
||||
"github.com/answerdev/answer/pkg/htmltext"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/segmentfault/pacman/errors"
|
||||
"github.com/segmentfault/pacman/i18n"
|
||||
|
@ -454,6 +455,7 @@ func (qs *QuestionService) GetQuestion(ctx context.Context, questionID, userID s
|
|||
if question.Status == entity.QuestionStatusClosed {
|
||||
per.CanClose = false
|
||||
}
|
||||
question.Description = htmltext.FetchExcerpt(question.HTML, "...", 240)
|
||||
question.MemberActions = permission.GetQuestionPermission(ctx, userID, question.UserID,
|
||||
per.CanEdit, per.CanDelete, per.CanClose, per.CanReopen)
|
||||
return question, nil
|
||||
|
|
|
@ -105,6 +105,7 @@ func (ts *TagService) GetTagInfo(ctx context.Context, req *schema.GetTagInfoReq)
|
|||
resp.DisplayName = tagInfo.DisplayName
|
||||
resp.OriginalText = tagInfo.OriginalText
|
||||
resp.ParsedText = tagInfo.ParsedText
|
||||
resp.Description = htmltext.FetchExcerpt(tagInfo.ParsedText, "...", 240)
|
||||
resp.FollowCount = tagInfo.FollowCount
|
||||
resp.QuestionCount = tagInfo.QuestionCount
|
||||
resp.Recommend = tagInfo.Recommend
|
||||
|
|
Loading…
Reference in New Issue