summaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-01-25 10:41:38 -0500
committerLunny Xiao <xiaolunwen@gmail.com>2017-01-25 23:41:38 +0800
commitda1b6164fe3384a43cd440e54a8a2a10defc3553 (patch)
tree2bead467341f8ace417030333fc3ada52b936481 /models/action.go
parent691fbdf1d362e77ab5eb2c42e51844b54a69b058 (diff)
downloadgitea-da1b6164fe3384a43cd440e54a8a2a10defc3553.tar.gz
gitea-da1b6164fe3384a43cd440e54a8a2a10defc3553.zip
Fix FIXME and remove superfluous queries in models/org (#749)
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/models/action.go b/models/action.go
index 112e9ec7b9..c736fabf38 100644
--- a/models/action.go
+++ b/models/action.go
@@ -658,17 +658,14 @@ func GetFeeds(ctxUser *User, actorID, offset int64, isProfile bool) ([]*Action,
And("is_private = ?", false).
And("act_user_id = ?", ctxUser.ID)
} else if actorID != -1 && ctxUser.IsOrganization() {
- // FIXME: only need to get IDs here, not all fields of repository.
- repos, _, err := ctxUser.GetUserRepositories(actorID, 1, ctxUser.NumRepos)
+ env, err := ctxUser.AccessibleReposEnv(actorID)
if err != nil {
- return nil, fmt.Errorf("GetUserRepositories: %v", err)
+ return nil, fmt.Errorf("AccessibleReposEnv: %v", err)
}
-
- var repoIDs []int64
- for _, repo := range repos {
- repoIDs = append(repoIDs, repo.ID)
+ repoIDs, err := env.RepoIDs(1, ctxUser.NumRepos)
+ if err != nil {
+ return nil, fmt.Errorf("GetUserRepositories: %v", err)
}
-
if len(repoIDs) > 0 {
sess.In("repo_id", repoIDs)
}