diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-04-30 13:08:09 +0800 |
---|---|---|
committer | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-04-30 13:08:09 +0800 |
commit | 0308d44a16d7bdcda75c1e946dc06efca48ed624 (patch) | |
tree | c75453c5a5d59ba59ce7a3939ca183d2d1eaec2f /routers/api/v1/repo/repo.go | |
parent | 00324cea108bd7625dffcfdbd0d86a4b67fe3f2f (diff) | |
download | gitea-0308d44a16d7bdcda75c1e946dc06efca48ed624.tar.gz gitea-0308d44a16d7bdcda75c1e946dc06efca48ed624.zip |
fix #1643 and improve integration test (#1645)
Diffstat (limited to 'routers/api/v1/repo/repo.go')
-rw-r--r-- | routers/api/v1/repo/repo.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 0f22eaeb8f..c0b8bb3d7b 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -55,6 +55,11 @@ func Search(ctx *context.APIContext) { return } + var userID int64 + if ctx.IsSigned { + userID = ctx.User.ID + } + results := make([]*api.Repository, len(repos)) for i, repo := range repos { if err = repo.GetOwner(); err != nil { @@ -64,7 +69,7 @@ func Search(ctx *context.APIContext) { }) return } - accessMode, err := models.AccessLevel(ctx.User.ID, repo) + accessMode, err := models.AccessLevel(userID, repo) if err != nil { ctx.JSON(500, map[string]interface{}{ "ok": false, |