summaryrefslogtreecommitdiffstats
path: root/models/user_mail.go
diff options
context:
space:
mode:
authorThibault Meyer <meyer.thibault@gmail.com>2016-11-10 16:16:32 +0100
committerThibault Meyer <meyer.thibault@gmail.com>2016-11-10 20:59:51 +0100
commita4454f5d0fbeaacb94668012acbb4296465cb28f (patch)
treeeaf39d1935eda44cf16df08234d2bbddd39c3ddd /models/user_mail.go
parentc040f2fbb13ef5ba2c6a619322d4801e9f78c885 (diff)
downloadgitea-a4454f5d0fbeaacb94668012acbb4296465cb28f.tar.gz
gitea-a4454f5d0fbeaacb94668012acbb4296465cb28f.zip
Rewrite XORM queries
Diffstat (limited to 'models/user_mail.go')
-rw-r--r--models/user_mail.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/models/user_mail.go b/models/user_mail.go
index 9a1804c91a..9dc3d624b4 100644
--- a/models/user_mail.go
+++ b/models/user_mail.go
@@ -22,7 +22,9 @@ type EmailAddress struct {
// GetEmailAddresses returns all email addresses belongs to given user.
func GetEmailAddresses(uid int64) ([]*EmailAddress, error) {
emails := make([]*EmailAddress, 0, 5)
- if err := x.Where("uid=?", uid).Find(&emails); err != nil {
+ if err := x.
+ Where("uid=?", uid).
+ Find(&emails); err != nil {
return nil, err
}
@@ -120,7 +122,10 @@ func (email *EmailAddress) Activate() error {
}
email.IsActivated = true
- if _, err := sess.Id(email.ID).AllCols().Update(email); err != nil {
+ if _, err := sess.
+ Id(email.ID).
+ AllCols().
+ Update(email); err != nil {
return err
} else if err = updateUser(sess, user); err != nil {
return err
@@ -133,7 +138,9 @@ func DeleteEmailAddress(email *EmailAddress) (err error) {
if email.ID > 0 {
_, err = x.Id(email.ID).Delete(new(EmailAddress))
} else {
- _, err = x.Where("email=?", email.Email).Delete(new(EmailAddress))
+ _, err = x.
+ Where("email=?", email.Email).
+ Delete(new(EmailAddress))
}
return err
}