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(rank): cancel rank rollback when remove question and answer.

LinkinStars6efaf0857eb0
diff --git a/internal/service/answer_service.go b/internal/service/answer_service.go
index 628753c4..ded279b8 100644
--- a/internal/service/answer_service.go
+++ b/internal/service/answer_service.go
@@ -127,10 +127,12 @@ func (as *AnswerService) RemoveAnswer(ctx context.Context, req *schema.RemoveAns
if err != nil {
return err
}
- err = as.answerActivityService.DeleteAnswer(ctx, answerInfo.ID, answerInfo.CreatedAt, answerInfo.VoteCount)
- if err != nil {
- log.Errorf("delete answer activity change failed: %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 = as.answerActivityService.DeleteAnswer(ctx, answerInfo.ID, answerInfo.CreatedAt, answerInfo.VoteCount)
+ //if err != nil {
+ // log.Errorf("delete answer activity change failed: %s", err.Error())
+ //}
activity_queue.AddActivity(&schema.ActivityMsg{
UserID: req.UserID,
ObjectID: answerInfo.ID,
@@ -458,17 +460,18 @@ func (as *AnswerService) AdminSetAnswerStatus(ctx context.Context, req *schema.A
}
if setStatus == entity.AnswerStatusDeleted {
- err = as.answerActivityService.DeleteAnswer(ctx, answerInfo.ID, answerInfo.CreatedAt, answerInfo.VoteCount)
- if err != nil {
- log.Errorf("admin delete question then rank rollback error %s", err.Error())
- } else {
- activity_queue.AddActivity(&schema.ActivityMsg{
- UserID: req.UserID,
- ObjectID: answerInfo.ID,
- OriginalObjectID: answerInfo.ID,
- ActivityTypeKey: constant.ActAnswerDeleted,
- })
- }
+ // #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 = as.answerActivityService.DeleteAnswer(ctx, answerInfo.ID, answerInfo.CreatedAt, answerInfo.VoteCount)
+ //if err != nil {
+ // log.Errorf("admin delete question then rank rollback error %s", err.Error())
+ //}
+ activity_queue.AddActivity(&schema.ActivityMsg{
+ UserID: req.UserID,
+ ObjectID: answerInfo.ID,
+ OriginalObjectID: answerInfo.ID,
+ ActivityTypeKey: constant.ActAnswerDeleted,
+ })
}
msg := &schema.NotificationMsg{}
diff --git a/internal/service/question_service.go b/internal/service/question_service.go
index d17d9dad..c98d1885 100644
--- a/internal/service/question_service.go
+++ b/internal/service/question_service.go
@@ -410,10 +410,12 @@ func (qs *QuestionService) RemoveQuestion(ctx context.Context, req *schema.Remov
log.Error("user IncreaseQuestionCount 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,
@@ -1014,10 +1016,12 @@ func (qs *QuestionService) AdminSetQuestionStatus(ctx context.Context, questionI
}
if setStatus == entity.QuestionStatusDeleted {
- err = qs.answerActivityService.DeleteQuestion(ctx, questionInfo.ID, questionInfo.CreatedAt, questionInfo.VoteCount)
- if err != nil {
- log.Errorf("admin delete question then 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("admin delete question then rank rollback error %s", err.Error())
+ //}
activity_queue.AddActivity(&schema.ActivityMsg{
UserID: questionInfo.UserID,
ObjectID: questionInfo.ID,