aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-07-24 01:08:22 +0800
committerUnknwon <u@gogs.io>2016-07-24 01:08:22 +0800
commit1f2e173a745da8e4b57f96b5561a3c10054d3b76 (patch)
tree367f0f07e4fe1269ac0772e0561a4bf912b5153c /routers/api/v1/repo
parent46e96c008cf966428c9dad71c7871de88186e3fe (diff)
downloadgitea-1f2e173a745da8e4b57f96b5561a3c10054d3b76.tar.gz
gitea-1f2e173a745da8e4b57f96b5561a3c10054d3b76.zip
Refactor User.Id to User.ID
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/issue.go8
-rw-r--r--routers/api/v1/repo/repo.go22
2 files changed, 15 insertions, 15 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index a3f69d3f81..b105b6816c 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -53,7 +53,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
issue := &models.Issue{
RepoID: ctx.Repo.Repository.ID,
Name: form.Title,
- PosterID: ctx.User.Id,
+ PosterID: ctx.User.ID,
Poster: ctx.User,
Content: form.Body,
}
@@ -69,7 +69,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
}
return
}
- issue.AssigneeID = assignee.Id
+ issue.AssigneeID = assignee.ID
}
issue.MilestoneID = form.Milestone
} else {
@@ -109,7 +109,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
return
}
- if !issue.IsPoster(ctx.User.Id) && !ctx.Repo.IsWriter() {
+ if !issue.IsPoster(ctx.User.ID) && !ctx.Repo.IsWriter() {
ctx.Status(403)
return
}
@@ -135,7 +135,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
}
return
}
- issue.AssigneeID = assignee.Id
+ issue.AssigneeID = assignee.ID
}
if err = models.UpdateIssueUserByAssignee(issue); err != nil {
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index 222098ac66..679ebb09d4 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -27,7 +27,7 @@ func Search(ctx *context.APIContext) {
// Check visibility.
if ctx.IsSigned && opts.OwnerID > 0 {
- if ctx.User.Id == opts.OwnerID {
+ if ctx.User.ID == opts.OwnerID {
opts.Private = true
} else {
u, err := models.GetUserByID(opts.OwnerID)
@@ -38,7 +38,7 @@ func Search(ctx *context.APIContext) {
})
return
}
- if u.IsOrganization() && u.IsOwnedBy(ctx.User.Id) {
+ if u.IsOrganization() && u.IsOwnedBy(ctx.User.ID) {
opts.Private = true
}
// FIXME: how about collaborators?
@@ -78,7 +78,7 @@ func Search(ctx *context.APIContext) {
// https://github.com/gogits/go-gogs-client/wiki/Repositories#list-your-repositories
func ListMyRepos(ctx *context.APIContext) {
- ownRepos, err := models.GetRepositories(ctx.User.Id, true)
+ ownRepos, err := models.GetRepositories(ctx.User.ID, true)
if err != nil {
ctx.Error(500, "GetRepositories", err)
return
@@ -126,7 +126,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
ctx.Error(422, "", err)
} else {
if repo != nil {
- if err = models.DeleteRepository(ctx.User.Id, repo.ID); err != nil {
+ if err = models.DeleteRepository(ctx.User.ID, repo.ID); err != nil {
log.Error(4, "DeleteRepository: %v", err)
}
}
@@ -159,7 +159,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
return
}
- if !org.IsOwnedBy(ctx.User.Id) {
+ if !org.IsOwnedBy(ctx.User.ID) {
ctx.Error(403, "", "Given user is not owner of organization.")
return
}
@@ -171,7 +171,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
ctxUser := ctx.User
// Not equal means context user is an organization,
// or is another user/organization if current user is admin.
- if form.Uid != ctxUser.Id {
+ if form.Uid != ctxUser.ID {
org, err := models.GetUserByID(form.Uid)
if err != nil {
if models.IsErrUserNotExist(err) {
@@ -191,7 +191,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
if ctxUser.IsOrganization() && !ctx.User.IsAdmin {
// Check ownership of organization.
- if !ctxUser.IsOwnedBy(ctx.User.Id) {
+ if !ctxUser.IsOwnedBy(ctx.User.ID) {
ctx.Error(403, "", "Given user is not owner of organization.")
return
}
@@ -226,7 +226,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
})
if err != nil {
if repo != nil {
- if errDelete := models.DeleteRepository(ctxUser.Id, repo.ID); errDelete != nil {
+ if errDelete := models.DeleteRepository(ctxUser.ID, repo.ID); errDelete != nil {
log.Error(4, "DeleteRepository: %v", errDelete)
}
}
@@ -249,7 +249,7 @@ func parseOwnerAndRepo(ctx *context.APIContext) (*models.User, *models.Repositor
return nil, nil
}
- repo, err := models.GetRepositoryByName(owner.Id, ctx.Params(":reponame"))
+ repo, err := models.GetRepositoryByName(owner.ID, ctx.Params(":reponame"))
if err != nil {
if models.IsErrRepoNotExist(err) {
ctx.Status(404)
@@ -279,12 +279,12 @@ func Delete(ctx *context.APIContext) {
return
}
- if owner.IsOrganization() && !owner.IsOwnedBy(ctx.User.Id) {
+ if owner.IsOrganization() && !owner.IsOwnedBy(ctx.User.ID) {
ctx.Error(403, "", "Given user is not owner of organization.")
return
}
- if err := models.DeleteRepository(owner.Id, repo.ID); err != nil {
+ if err := models.DeleteRepository(owner.ID, repo.ID); err != nil {
ctx.Error(500, "DeleteRepository", err)
return
}