Skip to content

Commit

Permalink
feat(queries.getprofile): add condition to get comment reward
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanngent2005 committed Apr 9, 2024
1 parent 44afaa5 commit 807db59
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/queries/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"coursebench-backend/pkg/errors"
"coursebench-backend/pkg/mail"
"coursebench-backend/pkg/models"
"coursebench-backend/pkg/queries"
"fmt"
"math/rand"
"strings"
Expand Down Expand Up @@ -352,11 +351,7 @@ func GetProfile(db *gorm.DB, id uint, uid uint) (models.ProfileResponse, error)
r.InvitationCode = user.InvitationCode
r.Reward = user.Reward
}
currentUser, err := queries.GetUserByID(nil, uid)
if err != nil {
return err
}
if currentUser.IsAdmin || !currentUser.IsCommunityAdmin {
if user.IsAdmin || user.IsCommunityAdmin {
r.Reward = user.Reward
}
return r, nil
Expand Down

0 comments on commit 807db59

Please sign in to comment.