aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-05 00:51:51 -0500
committerUnknwon <u@gogs.io>2016-03-05 00:51:51 -0500
commita2f13eae559c71d35662b7767a8b8347a26eb53e (patch)
tree35a02d0e6afaf1d9269dc9cee10b478d6c847560 /models
parent2a931937a8a92d5b1f3bca9e9cf4cbe23c862ce9 (diff)
downloadgitea-a2f13eae559c71d35662b7767a8b8347a26eb53e.tar.gz
gitea-a2f13eae559c71d35662b7767a8b8347a26eb53e.zip
#1157 some avatar setting changes
- Allow to delete current avatar
Diffstat (limited to 'models')
-rw-r--r--models/user.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/models/user.go b/models/user.go
index 6e7c27293d..3c87c4a64b 100644
--- a/models/user.go
+++ b/models/user.go
@@ -617,7 +617,7 @@ func ChangeUserName(u *User, newUserName string) (err error) {
}
func updateUser(e Engine, u *User) error {
- // Organization does not need e-mail.
+ // Organization does not need email
if !u.IsOrganization() {
u.Email = strings.ToLower(u.Email)
has, err := e.Where("id!=?", u.Id).And("type=?", u.Type).And("email=?", u.Email).Get(new(User))
@@ -634,16 +634,9 @@ func updateUser(e Engine, u *User) error {
}
u.LowerName = strings.ToLower(u.Name)
-
- if len(u.Location) > 255 {
- u.Location = u.Location[:255]
- }
- if len(u.Website) > 255 {
- u.Website = u.Website[:255]
- }
- if len(u.Description) > 255 {
- u.Description = u.Description[:255]
- }
+ u.Location = base.TruncateString(u.Location, 255)
+ u.Website = base.TruncateString(u.Website, 255)
+ u.Description = base.TruncateString(u.Description, 255)
u.FullName = markdown.Sanitizer.Sanitize(u.FullName)
_, err := e.Id(u.Id).AllCols().Update(u)