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: No operation is allowed when the reputation requirement is less than 0
LinkinStar645df9d20f2a
diff --git a/internal/service/rank/rank_service.go b/internal/service/rank/rank_service.goindex 4e257e30..9fa06cdb 100644--- a/internal/service/rank/rank_service.go+++ b/internal/service/rank/rank_service.go@@ -162,10 +162,9 @@ func (rs *RankService) checkUserRank(ctx context.Context, userID string, userRanif err != nil {return false, err}- currentUserRank := userRank- if currentUserRank < requireRank {+ if userRank < requireRank || requireRank < 0 {log.Debugf("user %s want to do action %s, but rank %d < %d",- userID, action, currentUserRank, requireRank)+ userID, action, userRank, requireRank)return false, nil}return true, nil