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.

Merge branch 'feat/1.1.0/report' into test

LinkinStarscd1252f0a020
diff --cc internal/service/question_service.go
index afba83ec,c98d1885..ccb281f6
--- a/internal/service/question_service.go
+++ b/internal/service/question_service.go
@@@ -425,39 -404,18 +425,41 @@@ func (qs *QuestionService) RemoveQuesti
return err
}
- // user add question count
- err = qs.userCommon.UpdateQuestionCount(ctx, questionInfo.UserID, -1)
+ userQuestionCount, err := qs.questioncommon.GetUserQuestionCount(ctx, questionInfo.UserID)
if err != nil {
- log.Error("user IncreaseQuestionCount error", err.Error())
+ log.Error("user GetUserQuestionCount error", err.Error())
+ } else {
+ err = qs.userCommon.UpdateQuestionCount(ctx, questionInfo.UserID, userQuestionCount)
+ if err != nil {
+ log.Error("user IncreaseQuestionCount error", err.Error())
+ }
+ }
+
+ //tag count
+ tagIDs := make([]string, 0)
+ Tags, tagerr := qs.tagCommon.GetObjectEntityTag(ctx, req.ID)
+ if tagerr != nil {
+ log.Error("GetObjectEntityTag error", tagerr)
+ return nil
+ }
+ for _, v := range Tags {
+ tagIDs = append(tagIDs, v.ID)
+ }
+ err = qs.tagCommon.RemoveTagRelListByObjectID(ctx, req.ID)
+ if err != nil {
+ log.Error("RemoveTagRelListByObjectID error", err.Error())
+ }
+ err = qs.tagCommon.RefreshTagQuestionCount(ctx, tagIDs)
+ if err != nil {
+ log.Error("efreshTagQuestionCount error", err.Error())
}
- err = qs.answerActivityService.DeleteQuestion(ctx, questionInfo.ID, questionInfo.CreatedAt, questionInfo.VoteCount)
- if err != nil {
- log.Errorf("user DeleteQuestion rank rollback error %s", err.Error())
- }
+ // #2372 In order to simplify the process and complexity, as well as to consider if it is in-house,
+ // facing the problem of recovery.
+ // err = qs.answerActivityService.DeleteQuestion(ctx, questionInfo.ID, questionInfo.CreatedAt, questionInfo.VoteCount)
+ // if err != nil {
+ // log.Errorf("user DeleteQuestion rank rollback error %s", err.Error())
+ // }
activity_queue.AddActivity(&schema.ActivityMsg{
UserID: req.UserID,
ObjectID: questionInfo.ID,