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.
update show Deleted question
aichy1265e33c28146b9
diff --git a/internal/schema/simple_obj_info_schema.go b/internal/schema/simple_obj_info_schema.goindex 28a7b775..8fa9c86a 100644--- a/internal/schema/simple_obj_info_schema.go+++ b/internal/schema/simple_obj_info_schema.go@@ -5,6 +5,7 @@ type SimpleObjectInfo struct {ObjectID string `json:"object_id"`ObjectCreatorUserID string `json:"object_creator_user_id"`QuestionID string `json:"question_id"`+ QuestionStatus int `json:"status"`AnswerID string `json:"answer_id"`CommentID string `json:"comment_id"`TagID string `json:"tag_id"`diff --git a/internal/service/comment/comment_service.go b/internal/service/comment/comment_service.goindex 654ee9f3..3e3db499 100644--- a/internal/service/comment/comment_service.go+++ b/internal/service/comment/comment_service.go@@ -452,6 +452,9 @@ func (cs *CommentService) GetCommentPersonalWithPage(ctx context.Context, req *scommentResp.UrlTitle = htmltext.UrlTitle(objInfo.Title)commentResp.QuestionID = objInfo.QuestionIDcommentResp.AnswerID = objInfo.AnswerID+ if objInfo.QuestionStatus == entity.QuestionStatusDeleted {+ commentResp.Title = "Deleted question"+ }}}resp = append(resp, commentResp)diff --git a/internal/service/object_info/object_info.go b/internal/service/object_info/object_info.goindex 5fbf55f7..feda14f9 100644--- a/internal/service/object_info/object_info.go+++ b/internal/service/object_info/object_info.go@@ -135,6 +135,7 @@ func (os *ObjService) GetInfo(ctx context.Context, objectID string) (objInfo *scObjectID: questionInfo.ID,ObjectCreatorUserID: questionInfo.UserID,QuestionID: questionInfo.ID,+ QuestionStatus: questionInfo.Status,ObjectType: objectType,Title: questionInfo.Title,Content: questionInfo.ParsedText, // todo trim@@ -158,6 +159,7 @@ func (os *ObjService) GetInfo(ctx context.Context, objectID string) (objInfo *scObjectID: answerInfo.ID,ObjectCreatorUserID: answerInfo.UserID,QuestionID: answerInfo.QuestionID,+ QuestionStatus: questionInfo.Status,AnswerID: answerInfo.ID,ObjectType: objectType,Title: questionInfo.Title, // this should be question title@@ -185,6 +187,7 @@ func (os *ObjService) GetInfo(ctx context.Context, objectID string) (objInfo *sc}if exist {objInfo.QuestionID = questionInfo.ID+ objInfo.QuestionStatus = questionInfo.StatusobjInfo.Title = questionInfo.Title}answerInfo, exist, err := os.answerRepo.GetAnswer(ctx, commentInfo.ObjectID)diff --git a/internal/service/question_service.go b/internal/service/question_service.goindex a1377882..25820563 100644--- a/internal/service/question_service.go+++ b/internal/service/question_service.go@@ -853,14 +853,18 @@ func (qs *QuestionService) PersonalAnswerPage(ctx context.Context, req *schema.P_, ok := questionMaps[item.QuestionID]if ok {item.QuestionInfo = questionMaps[item.QuestionID]+ } else {+ continue}info := &schema.UserAnswerInfo{}_ = copier.Copy(info, item)info.AnswerID = item.IDinfo.QuestionID = item.QuestionID- if item.QuestionInfo.Status != entity.QuestionStatusDeleted {- userAnswerlist = append(userAnswerlist, info)+ if item.QuestionInfo.Status == entity.QuestionStatusDeleted {+ info.QuestionInfo.Title = "Deleted question"+}+ userAnswerlist = append(userAnswerlist, info)}return pager.NewPageModel(total, userAnswerlist), nil@@ -894,6 +898,9 @@ func (qs *QuestionService) PersonalCollectionPage(ctx context.Context, req *schequestionMaps[uid.EnShortID(id)].UpdateUserInfo = nilquestionMaps[uid.EnShortID(id)].Content = ""questionMaps[uid.EnShortID(id)].HTML = ""+ if questionMaps[uid.EnShortID(id)].Status == entity.QuestionStatusDeleted {+ questionMaps[uid.EnShortID(id)].Title = "Deleted question"+ }list = append(list, questionMaps[uid.EnShortID(id)])}}diff --git a/internal/service/rank/rank_service.go b/internal/service/rank/rank_service.goindex 534913d8..4ef63d00 100644--- a/internal/service/rank/rank_service.go+++ b/internal/service/rank/rank_service.go@@ -269,6 +269,9 @@ func (rs *RankService) GetRankPersonalWithPage(ctx context.Context, req *schema.commentResp.Title = objInfo.TitlecommentResp.UrlTitle = htmltext.UrlTitle(objInfo.Title)commentResp.Content = objInfo.Content+ if objInfo.QuestionStatus == entity.QuestionStatusDeleted {+ commentResp.Title = "Deleted question"+ }commentResp.QuestionID = objInfo.QuestionIDcommentResp.AnswerID = objInfo.AnswerID}diff --git a/internal/service/vote_service.go b/internal/service/vote_service.goindex 39d4282d..41ea00e5 100644--- a/internal/service/vote_service.go+++ b/internal/service/vote_service.go@@ -195,6 +195,9 @@ func (vs *VoteService) ListUserVotes(ctx context.Context, req schema.GetVoteWithContent: objInfo.Content,VoteType: activity_type.Format(voteInfo.ActivityType),}+ if objInfo.QuestionStatus == entity.QuestionStatusDeleted {+ item.Title = "Deleted question"+ }resp = append(resp, item)}