From 6f1854cf60a1660b66b0642ada84e18e55df1a28 Mon Sep 17 00:00:00 2001 From: Yiyang Tan Date: Tue, 9 Apr 2024 21:22:38 +0800 Subject: [PATCH] feat(queries.GetProfile): use a new if block to add condition to get comment reward --- pkg/queries/user.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/queries/user.go b/pkg/queries/user.go index 27a92bd..5454093 100644 --- a/pkg/queries/user.go +++ b/pkg/queries/user.go @@ -349,9 +349,8 @@ func GetProfile(db *gorm.DB, id uint, uid uint) (models.ProfileResponse, error) r := models.ProfileResponse{ID: id, Email: user.Email, Year: user.Year, Grade: user.Grade, NickName: user.NickName, RealName: user.RealName, IsAnonymous: user.IsAnonymous, Avatar: avatar, IsAdmin: user.IsAdmin, IsCommunityAdmin: user.IsCommunityAdmin, Reward: user.Reward} if id == uid { r.InvitationCode = user.InvitationCode - r.Reward = user.Reward } - if user.IsAdmin || user.IsCommunityAdmin { + if id == uid || user.IsAdmin || user.IsCommunityAdmin { r.Reward = user.Reward } return r, nil