You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by sh...@apache.org on 2024/12/25 07:53:12 UTC

(incubator-answer) 04/04: fix: Apply code from review

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

shuai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git

commit 818329138111bde4bd818d71d122dd2e8e6f2303
Author: Luffy <52...@qq52o.cn>
AuthorDate: Tue Dec 24 17:29:01 2024 +0800

    fix: Apply code from review
---
 internal/repo/activity/vote_repo.go          | 3 +++
 internal/service/question_common/question.go | 1 +
 2 files changed, 4 insertions(+)

diff --git a/internal/repo/activity/vote_repo.go b/internal/repo/activity/vote_repo.go
index 7e8b02e6..37d907b0 100644
--- a/internal/repo/activity/vote_repo.go
+++ b/internal/repo/activity/vote_repo.go
@@ -240,6 +240,9 @@ func (vr *VoteRepo) setActivityRankToZeroIfUserReachLimit(ctx context.Context, s
 	op *schema.VoteOperationInfo, userInfoMapping map[string]*entity.User, maxDailyRank int) (err error) {
 	// check if user reach daily rank limit
 	for _, activity := range op.Activities {
+		if userInfoMapping[activity.ActivityUserID] == nil {
+			continue
+		}
 		if activity.Rank > 0 {
 			// check if reach max daily rank
 			reach, err := vr.userRankRepo.CheckReachLimit(ctx, session, activity.ActivityUserID, maxDailyRank)
diff --git a/internal/service/question_common/question.go b/internal/service/question_common/question.go
index c425d0a6..8a70fff6 100644
--- a/internal/service/question_common/question.go
+++ b/internal/service/question_common/question.go
@@ -384,6 +384,7 @@ func (qs *QuestionCommon) FormatQuestionsPage(
 			LastAnswerID:     questionInfo.LastAnswerID,
 			Pin:              questionInfo.Pin,
 			Show:             questionInfo.Show,
+			Operator:         &schema.QuestionPageRespOperator{ID: questionInfo.UserID},
 		}
 
 		questionIDs = append(questionIDs, questionInfo.ID)