make /users/full show CM notes and ban date when token has PrivilegeManageUser
This commit is contained in:
parent
366418f025
commit
8d92df534c
|
@ -197,6 +197,8 @@ type userFullResponse struct {
|
||||||
Badges []singleBadge `json:"badges"`
|
Badges []singleBadge `json:"badges"`
|
||||||
CustomBadge *singleBadge `json:"custom_badge"`
|
CustomBadge *singleBadge `json:"custom_badge"`
|
||||||
SilenceInfo silenceInfo `json:"silence_info"`
|
SilenceInfo silenceInfo `json:"silence_info"`
|
||||||
|
CMNotes *string `json:"cm_notes,omitempty"`
|
||||||
|
BanDate *common.UnixTimestamp `json:"ban_date,omitempty"`
|
||||||
}
|
}
|
||||||
type silenceInfo struct {
|
type silenceInfo struct {
|
||||||
Reason string `json:"reason"`
|
Reason string `json:"reason"`
|
||||||
|
@ -236,7 +238,8 @@ SELECT
|
||||||
users_stats.replays_watched_mania, users_stats.total_hits_mania,
|
users_stats.replays_watched_mania, users_stats.total_hits_mania,
|
||||||
users_stats.avg_accuracy_mania, users_stats.pp_mania,
|
users_stats.avg_accuracy_mania, users_stats.pp_mania,
|
||||||
|
|
||||||
users.silence_reason, users.silence_end
|
users.silence_reason, users.silence_end,
|
||||||
|
users.notes, users.ban_datetime
|
||||||
|
|
||||||
FROM users
|
FROM users
|
||||||
LEFT JOIN users_stats
|
LEFT JOIN users_stats
|
||||||
|
@ -276,6 +279,7 @@ LIMIT 1
|
||||||
&r.Mania.Accuracy, &r.Mania.PP,
|
&r.Mania.Accuracy, &r.Mania.PP,
|
||||||
|
|
||||||
&r.SilenceInfo.Reason, &r.SilenceInfo.End,
|
&r.SilenceInfo.Reason, &r.SilenceInfo.End,
|
||||||
|
&r.CMNotes, &r.BanDate,
|
||||||
)
|
)
|
||||||
switch {
|
switch {
|
||||||
case err == sql.ErrNoRows:
|
case err == sql.ErrNoRows:
|
||||||
|
@ -317,6 +321,11 @@ LIMIT 1
|
||||||
r.Badges = append(r.Badges, badge)
|
r.Badges = append(r.Badges, badge)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if md.User.TokenPrivileges&common.PrivilegeManageUser == 0 {
|
||||||
|
r.CMNotes = nil
|
||||||
|
r.BanDate = nil
|
||||||
|
}
|
||||||
|
|
||||||
r.Code = 200
|
r.Code = 200
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user