diff options
author | Ethan Koenig <etk39@cornell.edu> | 2017-03-14 20:51:46 -0400 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-03-15 08:51:46 +0800 |
commit | ec0ae5d50c59315a3c597b1cf24d4c5508c718e5 (patch) | |
tree | 6f4d6f826dd9866f9b39b66522ec629555700de2 /routers/api/v1/user | |
parent | 7d8f9d1c46e38681f2a4033a7da811ab7562d953 (diff) | |
download | gitea-ec0ae5d50c59315a3c597b1cf24d4c5508c718e5.tar.gz gitea-ec0ae5d50c59315a3c597b1cf24d4c5508c718e5.zip |
Refactor and fix incorrect comment (#1247)
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r-- | routers/api/v1/user/star.go | 7 | ||||
-rw-r--r-- | routers/api/v1/user/watch.go | 6 |
2 files changed, 3 insertions, 10 deletions
diff --git a/routers/api/v1/user/star.go b/routers/api/v1/user/star.go index 0937fd1903..47d3ed5079 100644 --- a/routers/api/v1/user/star.go +++ b/routers/api/v1/user/star.go @@ -18,13 +18,10 @@ func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) { if err != nil { return nil, err } - user, err := models.GetUserByID(userID) - if err != nil { - return nil, err - } + repos := make([]*api.Repository, len(starredRepos)) for i, starred := range starredRepos { - access, err := models.AccessLevel(user, starred) + access, err := models.AccessLevel(userID, starred) if err != nil { return nil, err } diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go index 6a9ad670d0..2a94e219fe 100644 --- a/routers/api/v1/user/watch.go +++ b/routers/api/v1/user/watch.go @@ -31,14 +31,10 @@ func getWatchedRepos(userID int64, private bool) ([]*api.Repository, error) { if err != nil { return nil, err } - user, err := models.GetUserByID(userID) - if err != nil { - return nil, err - } repos := make([]*api.Repository, len(watchedRepos)) for i, watched := range watchedRepos { - access, err := models.AccessLevel(user, watched) + access, err := models.AccessLevel(userID, watched) if err != nil { return nil, err } |