summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Kovalov <iamolegkovalov@gmail.com>2018-10-19 18:49:36 +0200
committertechknowlogick <hello@techknowlogick.com>2018-10-19 12:49:36 -0400
commita908b29a74ade0764f2c69b199e5f057abc902b6 (patch)
tree6efe3e2185b32f3e85423dafa6eaf862eeaa541b
parent616b8f42f982d53bea2d1bd9a4560065d80c66a1 (diff)
downloadgitea-a908b29a74ade0764f2c69b199e5f057abc902b6.tar.gz
gitea-a908b29a74ade0764f2c69b199e5f057abc902b6.zip
Remove duplicated if bodies (#5121)
-rw-r--r--models/user.go17
1 files changed, 5 insertions, 12 deletions
diff --git a/models/user.go b/models/user.go
index 6a9828d573..45bd4445ee 100644
--- a/models/user.go
+++ b/models/user.go
@@ -14,6 +14,7 @@ import (
"errors"
"fmt"
"image"
+
// Needed for jpeg support
_ "image/jpeg"
"image/png"
@@ -377,12 +378,8 @@ func (u *User) GetFollowers(page int) ([]*User, error) {
users := make([]*User, 0, ItemsPerPage)
sess := x.
Limit(ItemsPerPage, (page-1)*ItemsPerPage).
- Where("follow.follow_id=?", u.ID)
- if setting.UsePostgreSQL {
- sess = sess.Join("LEFT", "follow", "`user`.id=follow.user_id")
- } else {
- sess = sess.Join("LEFT", "follow", "`user`.id=follow.user_id")
- }
+ Where("follow.follow_id=?", u.ID).
+ Join("LEFT", "follow", "`user`.id=follow.user_id")
return users, sess.Find(&users)
}
@@ -396,12 +393,8 @@ func (u *User) GetFollowing(page int) ([]*User, error) {
users := make([]*User, 0, ItemsPerPage)
sess := x.
Limit(ItemsPerPage, (page-1)*ItemsPerPage).
- Where("follow.user_id=?", u.ID)
- if setting.UsePostgreSQL {
- sess = sess.Join("LEFT", "follow", "`user`.id=follow.follow_id")
- } else {
- sess = sess.Join("LEFT", "follow", "`user`.id=follow.follow_id")
- }
+ Where("follow.user_id=?", u.ID).
+ Join("LEFT", "follow", "`user`.id=follow.follow_id")
return users, sess.Find(&users)
}