Add GetUserNoCheck().

This commit is contained in:
Gucheng Wang 2021-11-20 15:46:54 +08:00
parent 91c0282040
commit 9eb09b7db0
2 changed files with 7 additions and 2 deletions

View File

@ -166,7 +166,7 @@ func (c *ApiController) UploadResource() {
switch tag {
case "avatar":
if user == nil {
user = object.GetUser(username)
user = object.GetUserNoCheck(username)
if user == nil {
c.ResponseError("user is nil for tag: \"avatar\"")
return

View File

@ -200,6 +200,11 @@ func GetUser(id string) *User {
return getUser(owner, name)
}
func GetUserNoCheck(id string) *User {
owner, name := util.GetOwnerAndNameFromIdNoCheck(id)
return getUser(owner, name)
}
func GetMaskedUser(user *User) *User {
if user == nil {
return nil
@ -233,7 +238,7 @@ func GetLastUser(owner string) *User {
}
func UpdateUser(id string, user *User) bool {
owner, name := util.GetOwnerAndNameFromId(id)
owner, name := util.GetOwnerAndNameFromIdNoCheck(id)
oldUser := getUser(owner, name)
if oldUser == nil {
return false