diff options
Diffstat (limited to 'routers/api/v1/user/repo.go')
-rw-r--r-- | routers/api/v1/user/repo.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go index 6111341423..6d0129681e 100644 --- a/routers/api/v1/user/repo.go +++ b/routers/api/v1/user/repo.go @@ -19,19 +19,19 @@ import ( func listUserRepos(ctx *context.APIContext, u *user_model.User, private bool) { opts := utils.GetListOptions(ctx) - repos, count, err := repo_model.GetUserRepositories(ctx, &repo_model.SearchRepoOptions{ + repos, count, err := repo_model.GetUserRepositories(ctx, repo_model.SearchRepoOptions{ Actor: u, Private: private, ListOptions: opts, OrderBy: "id ASC", }) if err != nil { - ctx.Error(http.StatusInternalServerError, "GetUserRepositories", err) + ctx.APIErrorInternal(err) return } if err := repos.LoadAttributes(ctx); err != nil { - ctx.Error(http.StatusInternalServerError, "RepositoryList.LoadAttributes", err) + ctx.APIErrorInternal(err) return } @@ -39,7 +39,7 @@ func listUserRepos(ctx *context.APIContext, u *user_model.User, private bool) { for i := range repos { permission, err := access_model.GetUserRepoPermission(ctx, repos[i], ctx.Doer) if err != nil { - ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err) + ctx.APIErrorInternal(err) return } if ctx.IsSigned && ctx.Doer.IsAdmin || permission.HasAnyUnitAccess() { @@ -62,7 +62,7 @@ func ListUserRepos(ctx *context.APIContext) { // parameters: // - name: username // in: path - // description: username of user + // description: username of the user whose owned repos are to be listed // type: string // required: true // - name: page @@ -103,7 +103,7 @@ func ListMyRepos(ctx *context.APIContext) { // "200": // "$ref": "#/responses/RepositoryList" - opts := &repo_model.SearchRepoOptions{ + opts := repo_model.SearchRepoOptions{ ListOptions: utils.GetListOptions(ctx), Actor: ctx.Doer, OwnerID: ctx.Doer.ID, @@ -113,19 +113,19 @@ func ListMyRepos(ctx *context.APIContext) { repos, count, err := repo_model.SearchRepository(ctx, opts) if err != nil { - ctx.Error(http.StatusInternalServerError, "SearchRepository", err) + ctx.APIErrorInternal(err) return } results := make([]*api.Repository, len(repos)) for i, repo := range repos { if err = repo.LoadOwner(ctx); err != nil { - ctx.Error(http.StatusInternalServerError, "LoadOwner", err) + ctx.APIErrorInternal(err) return } permission, err := access_model.GetUserRepoPermission(ctx, repo, ctx.Doer) if err != nil { - ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err) + ctx.APIErrorInternal(err) } results[i] = convert.ToRepo(ctx, repo, permission) } |