Made it easier to edit avatars

This commit is contained in:
2019-09-06 09:15:49 +09:00
parent 49547cc3b8
commit ca21bd5df0
7 changed files with 54 additions and 27 deletions

View File

@ -96,10 +96,10 @@ func (user *User) Edit(ctx aero.Context, key string, value reflect.Value, newVal
user.BirthDay = newBirthDay
return true, nil
case "ProExpires":
user := GetUserFromContext(ctx)
case "ProExpires", "Avatar.Extension", "Avatar.LastModified":
editor := GetUserFromContext(ctx)
if user == nil || user.Role != "admin" {
if editor == nil || editor.Role != "admin" {
return true, errors.New("Not authorized to edit")
}