diff options
author | Unknwon <u@gogs.io> | 2016-07-23 19:08:22 +0200 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-07-23 19:08:22 +0200 |
commit | 1f2e173a745da8e4b57f96b5561a3c10054d3b76 (patch) | |
tree | 367f0f07e4fe1269ac0772e0561a4bf912b5153c /routers/org | |
parent | Use struct for UI settings (diff) | |
download | forgejo-1f2e173a745da8e4b57f96b5561a3c10054d3b76.tar.xz forgejo-1f2e173a745da8e4b57f96b5561a3c10054d3b76.zip |
Refactor User.Id to User.ID
Diffstat (limited to 'routers/org')
-rw-r--r-- | routers/org/members.go | 12 | ||||
-rw-r--r-- | routers/org/setting.go | 6 | ||||
-rw-r--r-- | routers/org/teams.go | 10 |
3 files changed, 14 insertions, 14 deletions
diff --git a/routers/org/members.go b/routers/org/members.go index 1d720ce617..15998aa274 100644 --- a/routers/org/members.go +++ b/routers/org/members.go @@ -44,17 +44,17 @@ func MembersAction(ctx *context.Context) { var err error switch ctx.Params(":action") { case "private": - if ctx.User.Id != uid && !ctx.Org.IsOwner { + if ctx.User.ID != uid && !ctx.Org.IsOwner { ctx.Error(404) return } - err = models.ChangeOrgUserStatus(org.Id, uid, false) + err = models.ChangeOrgUserStatus(org.ID, uid, false) case "public": - if ctx.User.Id != uid && !ctx.Org.IsOwner { + if ctx.User.ID != uid && !ctx.Org.IsOwner { ctx.Error(404) return } - err = models.ChangeOrgUserStatus(org.Id, uid, true) + err = models.ChangeOrgUserStatus(org.ID, uid, true) case "remove": if !ctx.Org.IsOwner { ctx.Error(404) @@ -67,7 +67,7 @@ func MembersAction(ctx *context.Context) { return } case "leave": - err = org.RemoveMember(ctx.User.Id) + err = org.RemoveMember(ctx.User.ID) if models.IsErrLastOrgOwner(err) { ctx.Flash.Error(ctx.Tr("form.last_org_owner")) ctx.Redirect(ctx.Org.OrgLink + "/members") @@ -109,7 +109,7 @@ func Invitation(ctx *context.Context) { return } - if err = org.AddMember(u.Id); err != nil { + if err = org.AddMember(u.ID); err != nil { ctx.Handle(500, " AddMember", err) return } diff --git a/routers/org/setting.go b/routers/org/setting.go index 7900613b77..128fba36a8 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -41,7 +41,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) { // Check if organization name has been changed. if org.LowerName != strings.ToLower(form.Name) { - isExist, err := models.IsUserExist(org.Id, form.Name) + isExist, err := models.IsUserExist(org.ID, form.Name) if err != nil { ctx.Handle(500, "IsUserExist", err) return @@ -140,7 +140,7 @@ func Webhooks(ctx *context.Context) { ctx.Data["BaseLink"] = ctx.Org.OrgLink ctx.Data["Description"] = ctx.Tr("org.settings.hooks_desc") - ws, err := models.GetWebhooksByOrgID(ctx.Org.Organization.Id) + ws, err := models.GetWebhooksByOrgID(ctx.Org.Organization.ID) if err != nil { ctx.Handle(500, "GetWebhooksByOrgId", err) return @@ -151,7 +151,7 @@ func Webhooks(ctx *context.Context) { } func DeleteWebhook(ctx *context.Context) { - if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.Id, ctx.QueryInt64("id")); err != nil { + if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.ID, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteWebhookByOrgID: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success")) diff --git a/routers/org/teams.go b/routers/org/teams.go index 430f08ec28..3d0456423a 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -54,9 +54,9 @@ func TeamsAction(ctx *context.Context) { ctx.Error(404) return } - err = ctx.Org.Team.AddMember(ctx.User.Id) + err = ctx.Org.Team.AddMember(ctx.User.ID) case "leave": - err = ctx.Org.Team.RemoveMember(ctx.User.Id) + err = ctx.Org.Team.RemoveMember(ctx.User.ID) case "remove": if !ctx.Org.IsOwner { ctx.Error(404) @@ -82,7 +82,7 @@ func TeamsAction(ctx *context.Context) { return } - err = ctx.Org.Team.AddMember(u.Id) + err = ctx.Org.Team.AddMember(u.ID) page = "team" } @@ -118,7 +118,7 @@ func TeamsRepoAction(ctx *context.Context) { case "add": repoName := path.Base(ctx.Query("repo_name")) var repo *models.Repository - repo, err = models.GetRepositoryByName(ctx.Org.Organization.Id, repoName) + repo, err = models.GetRepositoryByName(ctx.Org.Organization.ID, repoName) if err != nil { if models.IsErrRepoNotExist(err) { ctx.Flash.Error(ctx.Tr("org.teams.add_nonexistent_repo")) @@ -155,7 +155,7 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) { ctx.Data["PageIsOrgTeamsNew"] = true t := &models.Team{ - OrgID: ctx.Org.Organization.Id, + OrgID: ctx.Org.Organization.ID, Name: form.TeamName, Description: form.Description, Authorize: models.ParseAccessMode(form.Permission), |