Browse Source

Refactor User.Id to User.ID

Unknwon 3 years ago
parent
commit
1f2e173a74
79 changed files with 333 additions and 328 deletions
  1. 1 1
      README.md
  2. 2 2
      cmd/serve.go
  3. 1 1
      gogs.go
  4. 7 7
      models/access.go
  5. 10 10
      models/action.go
  6. 6 6
      models/issue.go
  7. 2 2
      models/issue_comment.go
  8. 1 1
      models/issue_mail.go
  9. 2 2
      models/login.go
  10. 4 4
      models/mail.go
  11. 23 23
      models/org.go
  12. 4 4
      models/org_team.go
  13. 3 3
      models/pull.go
  14. 14 14
      models/repo.go
  15. 1 1
      models/repo_collaboration.go
  16. 3 3
      models/ssh_key.go
  17. 3 3
      models/update.go
  18. 43 43
      models/user.go
  19. 3 3
      models/user_mail.go
  20. 1 1
      modules/context/context.go
  21. 3 3
      modules/context/org.go
  22. 3 3
      modules/context/repo.go
  23. 1 1
      routers/admin/repos.go
  24. 1 1
      routers/admin/users.go
  25. 3 3
      routers/api/v1/admin/org_team.go
  26. 1 1
      routers/api/v1/admin/user.go
  27. 1 1
      routers/api/v1/api.go
  28. 2 2
      routers/api/v1/convert/convert.go
  29. 1 1
      routers/api/v1/org/org.go
  30. 4 4
      routers/api/v1/repo/issue.go
  31. 11 11
      routers/api/v1/repo/repo.go
  32. 2 2
      routers/api/v1/user/app.go
  33. 2 2
      routers/api/v1/user/email.go
  34. 4 4
      routers/api/v1/user/follower.go
  35. 3 3
      routers/api/v1/user/key.go
  36. 2 2
      routers/api/v1/user/user.go
  37. 1 1
      routers/install.go
  38. 6 6
      routers/org/members.go
  39. 3 3
      routers/org/setting.go
  40. 5 5
      routers/org/teams.go
  41. 2 2
      routers/repo/http.go
  42. 12 12
      routers/repo/issue.go
  43. 5 5
      routers/repo/pull.go
  44. 1 1
      routers/repo/release.go
  45. 9 9
      routers/repo/repo.go
  46. 7 7
      routers/repo/setting.go
  47. 3 3
      routers/repo/webhook.go
  48. 4 4
      routers/user/auth.go
  49. 21 16
      routers/user/home.go
  50. 6 6
      routers/user/profile.go
  51. 10 10
      routers/user/setting.go
  52. 1 1
      templates/.VERSION
  53. 1 1
      templates/admin/base/page.tmpl
  54. 1 1
      templates/admin/base/search.tmpl
  55. 1 1
      templates/admin/org/list.tmpl
  56. 1 1
      templates/admin/user/edit.tmpl
  57. 2 2
      templates/admin/user/list.tmpl
  58. 1 1
      templates/explore/page.tmpl
  59. 1 1
      templates/explore/search.tmpl
  60. 1 1
      templates/mail/issue/mention.tmpl
  61. 2 2
      templates/org/home.tmpl
  62. 7 7
      templates/org/member/members.tmpl
  63. 2 2
      templates/org/team/members.tmpl
  64. 1 1
      templates/org/team/repositories.tmpl
  65. 3 3
      templates/org/team/sidebar.tmpl
  66. 3 3
      templates/org/team/teams.tmpl
  67. 3 3
      templates/repo/create.tmpl
  68. 1 1
      templates/repo/issue/list.tmpl
  69. 2 2
      templates/repo/issue/new_form.tmpl
  70. 7 7
      templates/repo/issue/view_content.tmpl
  71. 3 3
      templates/repo/issue/view_title.tmpl
  72. 3 3
      templates/repo/migrate.tmpl
  73. 4 4
      templates/repo/pulls/fork.tmpl
  74. 2 2
      templates/repo/settings/collaboration.tmpl
  75. 1 1
      templates/repo/user_cards.tmpl
  76. 2 2
      templates/user/dashboard/navbar.tmpl
  77. 1 1
      templates/user/meta/followers.tmpl
  78. 2 2
      templates/user/meta/header.tmpl
  79. 1 1
      templates/user/profile.tmpl

+ 1 - 1
README.md

@@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
3 3
 
4 4
 ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
5 5
 
6
-##### Current tip version: 0.9.52 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
6
+##### Current tip version: 0.9.53 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
7 7
 
8 8
 | Web | UI  | Preview  |
9 9
 |:-------------:|:-------:|:-------:|

+ 2 - 2
cmd/serve.go

@@ -103,7 +103,7 @@ func handleUpdateTask(uuid string, user, repoUser *models.User, reponame string,
103 103
 		RefName:      task.RefName,
104 104
 		OldCommitID:  task.OldCommitID,
105 105
 		NewCommitID:  task.NewCommitID,
106
-		PusherID:     user.Id,
106
+		PusherID:     user.ID,
107 107
 		PusherName:   user.Name,
108 108
 		RepoUserName: repoUser.Name,
109 109
 		RepoName:     reponame,
@@ -175,7 +175,7 @@ func runServ(c *cli.Context) error {
175 175
 		fail("Internal error", "Failed to get repository owner (%s): %v", username, err)
176 176
 	}
177 177
 
178
-	repo, err := models.GetRepositoryByName(repoUser.Id, reponame)
178
+	repo, err := models.GetRepositoryByName(repoUser.ID, reponame)
179 179
 	if err != nil {
180 180
 		if models.IsErrRepoNotExist(err) {
181 181
 			fail(_ACCESS_DENIED_MESSAGE, "Repository does not exist: %s/%s", repoUser.Name, reponame)

+ 1 - 1
gogs.go

@@ -17,7 +17,7 @@ import (
17 17
 	"github.com/gogits/gogs/modules/setting"
18 18
 )
19 19
 
20
-const APP_VER = "0.9.52.0723"
20
+const APP_VER = "0.9.53.0724"
21 21
 
22 22
 func init() {
23 23
 	runtime.GOMAXPROCS(runtime.NumCPU())

+ 7 - 7
models/access.go

@@ -67,11 +67,11 @@ func accessLevel(e Engine, u *User, repo *Repository) (AccessMode, error) {
67 67
 		return mode, nil
68 68
 	}
69 69
 
70
-	if u.Id == repo.OwnerID {
70
+	if u.ID == repo.OwnerID {
71 71
 		return ACCESS_MODE_OWNER, nil
72 72
 	}
73 73
 
74
-	a := &Access{UserID: u.Id, RepoID: repo.ID}
74
+	a := &Access{UserID: u.ID, RepoID: repo.ID}
75 75
 	if has, err := e.Get(a); !has || err != nil {
76 76
 		return mode, err
77 77
 	}
@@ -97,7 +97,7 @@ func HasAccess(u *User, repo *Repository, testMode AccessMode) (bool, error) {
97 97
 // GetRepositoryAccesses finds all repositories with their access mode where a user has access but does not own.
98 98
 func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error) {
99 99
 	accesses := make([]*Access, 0, 10)
100
-	if err := x.Find(&accesses, &Access{UserID: u.Id}); err != nil {
100
+	if err := x.Find(&accesses, &Access{UserID: u.ID}); err != nil {
101 101
 		return nil, err
102 102
 	}
103 103
 
@@ -113,7 +113,7 @@ func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error) {
113 113
 		}
114 114
 		if err = repo.GetOwner(); err != nil {
115 115
 			return nil, err
116
-		} else if repo.OwnerID == u.Id {
116
+		} else if repo.OwnerID == u.ID {
117 117
 			continue
118 118
 		}
119 119
 		repos[repo] = access.Mode
@@ -124,7 +124,7 @@ func (u *User) GetRepositoryAccesses() (map[*Repository]AccessMode, error) {
124 124
 // GetAccessibleRepositories finds all repositories where a user has access but does not own.
125 125
 func (u *User) GetAccessibleRepositories() ([]*Repository, error) {
126 126
 	accesses := make([]*Access, 0, 10)
127
-	if err := x.Find(&accesses, &Access{UserID: u.Id}); err != nil {
127
+	if err := x.Find(&accesses, &Access{UserID: u.ID}); err != nil {
128 128
 		return nil, err
129 129
 	}
130 130
 
@@ -137,7 +137,7 @@ func (u *User) GetAccessibleRepositories() ([]*Repository, error) {
137 137
 		repoIDs = append(repoIDs, access.RepoID)
138 138
 	}
139 139
 	repos := make([]*Repository, 0, len(repoIDs))
140
-	return repos, x.Where("owner_id != ?", u.Id).In("id", repoIDs).Desc("updated_unix").Find(&repos)
140
+	return repos, x.Where("owner_id != ?", u.ID).In("id", repoIDs).Desc("updated_unix").Find(&repos)
141 141
 }
142 142
 
143 143
 func maxAccessMode(modes ...AccessMode) AccessMode {
@@ -227,7 +227,7 @@ func (repo *Repository) recalculateTeamAccesses(e Engine, ignTeamID int64) (err
227 227
 			return fmt.Errorf("getMembers '%d': %v", t.ID, err)
228 228
 		}
229 229
 		for _, m := range t.Members {
230
-			accessMap[m.Id] = maxAccessMode(accessMap[m.Id], t.Authorize)
230
+			accessMap[m.ID] = maxAccessMode(accessMap[m.ID], t.Authorize)
231 231
 		}
232 232
 	}
233 233
 

+ 10 - 10
models/action.go

@@ -184,7 +184,7 @@ func (a *Action) GetIssueContent() string {
184 184
 
185 185
 func newRepoAction(e Engine, u *User, repo *Repository) (err error) {
186 186
 	if err = notifyWatchers(e, &Action{
187
-		ActUserID:    u.Id,
187
+		ActUserID:    u.ID,
188 188
 		ActUserName:  u.Name,
189 189
 		ActEmail:     u.Email,
190 190
 		OpType:       ACTION_CREATE_REPO,
@@ -193,7 +193,7 @@ func newRepoAction(e Engine, u *User, repo *Repository) (err error) {
193 193
 		RepoName:     repo.Name,
194 194
 		IsPrivate:    repo.IsPrivate,
195 195
 	}); err != nil {
196
-		return fmt.Errorf("notify watchers '%d/%d': %v", u.Id, repo.ID, err)
196
+		return fmt.Errorf("notify watchers '%d/%d': %v", u.ID, repo.ID, err)
197 197
 	}
198 198
 
199 199
 	log.Trace("action.newRepoAction: %s/%s", u.Name, repo.Name)
@@ -207,7 +207,7 @@ func NewRepoAction(u *User, repo *Repository) (err error) {
207 207
 
208 208
 func renameRepoAction(e Engine, actUser *User, oldRepoName string, repo *Repository) (err error) {
209 209
 	if err = notifyWatchers(e, &Action{
210
-		ActUserID:    actUser.Id,
210
+		ActUserID:    actUser.ID,
211 211
 		ActUserName:  actUser.Name,
212 212
 		ActEmail:     actUser.Email,
213 213
 		OpType:       ACTION_RENAME_REPO,
@@ -482,7 +482,7 @@ func CommitRepoAction(
482 482
 	refName := git.RefEndName(refFullName)
483 483
 
484 484
 	if err = NotifyWatchers(&Action{
485
-		ActUserID:    u.Id,
485
+		ActUserID:    u.ID,
486 486
 		ActUserName:  userName,
487 487
 		ActEmail:     actEmail,
488 488
 		OpType:       opType,
@@ -506,7 +506,7 @@ func CommitRepoAction(
506 506
 	}
507 507
 	payloadSender := &api.PayloadUser{
508 508
 		UserName:  pusher.Name,
509
-		ID:        pusher.Id,
509
+		ID:        pusher.ID,
510 510
 		AvatarUrl: pusher.AvatarLink(),
511 511
 	}
512 512
 
@@ -553,7 +553,7 @@ func CommitRepoAction(
553 553
 
554 554
 func transferRepoAction(e Engine, actUser, oldOwner, newOwner *User, repo *Repository) (err error) {
555 555
 	if err = notifyWatchers(e, &Action{
556
-		ActUserID:    actUser.Id,
556
+		ActUserID:    actUser.ID,
557 557
 		ActUserName:  actUser.Name,
558 558
 		ActEmail:     actUser.Email,
559 559
 		OpType:       ACTION_TRANSFER_REPO,
@@ -563,12 +563,12 @@ func transferRepoAction(e Engine, actUser, oldOwner, newOwner *User, repo *Repos
563 563
 		IsPrivate:    repo.IsPrivate,
564 564
 		Content:      path.Join(oldOwner.Name, repo.Name),
565 565
 	}); err != nil {
566
-		return fmt.Errorf("notify watchers '%d/%d': %v", actUser.Id, repo.ID, err)
566
+		return fmt.Errorf("notify watchers '%d/%d': %v", actUser.ID, repo.ID, err)
567 567
 	}
568 568
 
569 569
 	// Remove watch for organization.
570 570
 	if repo.Owner.IsOrganization() {
571
-		if err = watchRepo(e, repo.Owner.Id, repo.ID, false); err != nil {
571
+		if err = watchRepo(e, repo.Owner.ID, repo.ID, false); err != nil {
572 572
 			return fmt.Errorf("watch repository: %v", err)
573 573
 		}
574 574
 	}
@@ -584,7 +584,7 @@ func TransferRepoAction(actUser, oldOwner, newOwner *User, repo *Repository) err
584 584
 
585 585
 func mergePullRequestAction(e Engine, actUser *User, repo *Repository, pull *Issue) error {
586 586
 	return notifyWatchers(e, &Action{
587
-		ActUserID:    actUser.Id,
587
+		ActUserID:    actUser.ID,
588 588
 		ActUserName:  actUser.Name,
589 589
 		ActEmail:     actUser.Email,
590 590
 		OpType:       ACTION_MERGE_PULL_REQUEST,
@@ -610,7 +610,7 @@ func GetFeeds(ctxUserID, userID, offset int64, isProfile bool) ([]*Action, error
610 610
 	if isProfile {
611 611
 		sess.And("is_private=?", false).And("act_user_id=?", ctxUserID)
612 612
 	} else if ctxUserID != -1 {
613
-		ctxUser := &User{Id: ctxUserID}
613
+		ctxUser := &User{ID: ctxUserID}
614 614
 		if err := ctxUser.GetUserRepositories(userID); err != nil {
615 615
 			return nil, err
616 616
 		}

+ 6 - 6
models/issue.go

@@ -336,7 +336,7 @@ func newIssue(e *xorm.Session, repo *Repository, issue *Issue, labelIDs []int64,
336 336
 
337 337
 	if issue.AssigneeID > 0 {
338 338
 		// Silently drop invalid assignee
339
-		valid, err := hasAccess(e, &User{Id: issue.AssigneeID}, repo, ACCESS_MODE_WRITE)
339
+		valid, err := hasAccess(e, &User{ID: issue.AssigneeID}, repo, ACCESS_MODE_WRITE)
340 340
 		if err != nil {
341 341
 			return fmt.Errorf("hasAccess: %v", err)
342 342
 		} else if !valid {
@@ -428,7 +428,7 @@ func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string)
428 428
 
429 429
 	// Notify watchers.
430 430
 	act := &Action{
431
-		ActUserID:    issue.Poster.Id,
431
+		ActUserID:    issue.Poster.ID,
432 432
 		ActUserName:  issue.Poster.Name,
433 433
 		ActEmail:     issue.Poster.Email,
434 434
 		OpType:       ACTION_CREATE_ISSUE,
@@ -632,7 +632,7 @@ func newIssueUsers(e *xorm.Session, repo *Repository, issue *Issue) error {
632 632
 	isNeedAddPoster := true
633 633
 	for _, u := range users {
634 634
 		iu.ID = 0
635
-		iu.UID = u.Id
635
+		iu.UID = u.ID
636 636
 		iu.IsPoster = iu.UID == issue.PosterID
637 637
 		if isNeedAddPoster && iu.IsPoster {
638 638
 			isNeedAddPoster = false
@@ -736,15 +736,15 @@ func UpdateIssueMentions(issueID int64, mentions []string) error {
736 736
 
737 737
 	ids := make([]int64, 0, len(mentions))
738 738
 	for _, user := range users {
739
-		ids = append(ids, user.Id)
739
+		ids = append(ids, user.ID)
740 740
 		if !user.IsOrganization() || user.NumMembers == 0 {
741 741
 			continue
742 742
 		}
743 743
 
744 744
 		memberIDs := make([]int64, 0, user.NumMembers)
745
-		orgUsers, err := GetOrgUsersByOrgID(user.Id)
745
+		orgUsers, err := GetOrgUsersByOrgID(user.ID)
746 746
 		if err != nil {
747
-			return fmt.Errorf("GetOrgUsersByOrgID [%d]: %v", user.Id, err)
747
+			return fmt.Errorf("GetOrgUsersByOrgID [%d]: %v", user.ID, err)
748 748
 		}
749 749
 
750 750
 		for _, orgUser := range orgUsers {

+ 2 - 2
models/issue_comment.go

@@ -140,7 +140,7 @@ func (cmt *Comment) MailParticipants(opType ActionType, issue *Issue) (err error
140 140
 func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err error) {
141 141
 	comment := &Comment{
142 142
 		Type:      opts.Type,
143
-		PosterID:  opts.Doer.Id,
143
+		PosterID:  opts.Doer.ID,
144 144
 		Poster:    opts.Doer,
145 145
 		IssueID:   opts.Issue.ID,
146 146
 		CommitID:  opts.CommitID,
@@ -155,7 +155,7 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
155 155
 	// Compose comment action, could be plain comment, close or reopen issue/pull request.
156 156
 	// This object will be used to notify watchers in the end of function.
157 157
 	act := &Action{
158
-		ActUserID:    opts.Doer.Id,
158
+		ActUserID:    opts.Doer.ID,
159 159
 		ActUserName:  opts.Doer.Name,
160 160
 		ActEmail:     opts.Doer.Email,
161 161
 		Content:      fmt.Sprintf("%d|%s", opts.Issue.Index, strings.Split(opts.Content, "\n")[0]),

+ 1 - 1
models/issue_mail.go

@@ -33,7 +33,7 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
33 33
 	tos := make([]string, 0, len(watchers)) // List of email addresses.
34 34
 	names := make([]string, 0, len(watchers))
35 35
 	for i := range watchers {
36
-		if watchers[i].UserID == doer.Id {
36
+		if watchers[i].UserID == doer.ID {
37 37
 			continue
38 38
 		}
39 39
 

+ 2 - 2
models/login.go

@@ -534,7 +534,7 @@ func UserSignIn(uname, passwd string) (*User, error) {
534 534
 				return u, nil
535 535
 			}
536 536
 
537
-			return nil, ErrUserNotExist{u.Id, u.Name}
537
+			return nil, ErrUserNotExist{u.ID, u.Name}
538 538
 
539 539
 		default:
540 540
 			var source LoginSource
@@ -563,5 +563,5 @@ func UserSignIn(uname, passwd string) (*User, error) {
563 563
 		log.Warn("Failed to login '%s' via '%s': %v", uname, source.Name, err)
564 564
 	}
565 565
 
566
-	return nil, ErrUserNotExist{u.Id, u.Name}
566
+	return nil, ErrUserNotExist{u.ID, u.Name}
567 567
 }

+ 4 - 4
models/mail.go

@@ -71,7 +71,7 @@ func SendUserMail(c *macaron.Context, u *User, tpl base.TplName, code, subject,
71 71
 	}
72 72
 
73 73
 	msg := mailer.NewMessage([]string{u.Email}, subject, body)
74
-	msg.Info = fmt.Sprintf("UID: %d, %s", u.Id, info)
74
+	msg.Info = fmt.Sprintf("UID: %d, %s", u.ID, info)
75 75
 
76 76
 	mailer.SendAsync(msg)
77 77
 }
@@ -99,7 +99,7 @@ func SendActivateEmailMail(c *macaron.Context, u *User, email *EmailAddress) {
99 99
 	}
100 100
 
101 101
 	msg := mailer.NewMessage([]string{email.Email}, c.Tr("mail.activate_email"), body)
102
-	msg.Info = fmt.Sprintf("UID: %d, activate email", u.Id)
102
+	msg.Info = fmt.Sprintf("UID: %d, activate email", u.ID)
103 103
 
104 104
 	mailer.SendAsync(msg)
105 105
 }
@@ -116,7 +116,7 @@ func SendRegisterNotifyMail(c *macaron.Context, u *User) {
116 116
 	}
117 117
 
118 118
 	msg := mailer.NewMessage([]string{u.Email}, c.Tr("mail.register_notify"), body)
119
-	msg.Info = fmt.Sprintf("UID: %d, registration notify", u.Id)
119
+	msg.Info = fmt.Sprintf("UID: %d, registration notify", u.ID)
120 120
 
121 121
 	mailer.SendAsync(msg)
122 122
 }
@@ -138,7 +138,7 @@ func SendCollaboratorMail(u, doer *User, repo *Repository) {
138 138
 	}
139 139
 
140 140
 	msg := mailer.NewMessage([]string{u.Email}, subject, body)
141
-	msg.Info = fmt.Sprintf("UID: %d, add collaborator", u.Id)
141
+	msg.Info = fmt.Sprintf("UID: %d, add collaborator", u.ID)
142 142
 
143 143
 	mailer.SendAsync(msg)
144 144
 }

+ 23 - 23
models/org.go

@@ -21,16 +21,16 @@ var (
21 21
 
22 22
 // IsOwnedBy returns true if given user is in the owner team.
23 23
 func (org *User) IsOwnedBy(uid int64) bool {
24
-	return IsOrganizationOwner(org.Id, uid)
24
+	return IsOrganizationOwner(org.ID, uid)
25 25
 }
26 26
 
27 27
 // IsOrgMember returns true if given user is member of organization.
28 28
 func (org *User) IsOrgMember(uid int64) bool {
29
-	return org.IsOrganization() && IsOrganizationMember(org.Id, uid)
29
+	return org.IsOrganization() && IsOrganizationMember(org.ID, uid)
30 30
 }
31 31
 
32 32
 func (org *User) getTeam(e Engine, name string) (*Team, error) {
33
-	return getTeam(e, org.Id, name)
33
+	return getTeam(e, org.ID, name)
34 34
 }
35 35
 
36 36
 // GetTeam returns named team of organization.
@@ -48,7 +48,7 @@ func (org *User) GetOwnerTeam() (*Team, error) {
48 48
 }
49 49
 
50 50
 func (org *User) getTeams(e Engine) error {
51
-	return e.Where("org_id=?", org.Id).Find(&org.Teams)
51
+	return e.Where("org_id=?", org.ID).Find(&org.Teams)
52 52
 }
53 53
 
54 54
 // GetTeams returns all teams that belong to organization.
@@ -58,7 +58,7 @@ func (org *User) GetTeams() error {
58 58
 
59 59
 // GetMembers returns all members of organization.
60 60
 func (org *User) GetMembers() error {
61
-	ous, err := GetOrgUsersByOrgID(org.Id)
61
+	ous, err := GetOrgUsersByOrgID(org.ID)
62 62
 	if err != nil {
63 63
 		return err
64 64
 	}
@@ -75,16 +75,16 @@ func (org *User) GetMembers() error {
75 75
 
76 76
 // AddMember adds new member to organization.
77 77
 func (org *User) AddMember(uid int64) error {
78
-	return AddOrgUser(org.Id, uid)
78
+	return AddOrgUser(org.ID, uid)
79 79
 }
80 80
 
81 81
 // RemoveMember removes member from organization.
82 82
 func (org *User) RemoveMember(uid int64) error {
83
-	return RemoveOrgUser(org.Id, uid)
83
+	return RemoveOrgUser(org.ID, uid)
84 84
 }
85 85
 
86 86
 func (org *User) removeOrgRepo(e Engine, repoID int64) error {
87
-	return removeOrgRepo(e, org.Id, repoID)
87
+	return removeOrgRepo(e, org.ID, repoID)
88 88
 }
89 89
 
90 90
 // RemoveOrgRepo removes all team-repository relations of organization.
@@ -126,8 +126,8 @@ func CreateOrganization(org, owner *User) (err error) {
126 126
 
127 127
 	// Add initial creator to organization and owner team.
128 128
 	if _, err = sess.Insert(&OrgUser{
129
-		Uid:      owner.Id,
130
-		OrgID:    org.Id,
129
+		Uid:      owner.ID,
130
+		OrgID:    org.ID,
131 131
 		IsOwner:  true,
132 132
 		NumTeams: 1,
133 133
 	}); err != nil {
@@ -136,7 +136,7 @@ func CreateOrganization(org, owner *User) (err error) {
136 136
 
137 137
 	// Create default owner team.
138 138
 	t := &Team{
139
-		OrgID:      org.Id,
139
+		OrgID:      org.ID,
140 140
 		LowerName:  strings.ToLower(OWNER_TEAM),
141 141
 		Name:       OWNER_TEAM,
142 142
 		Authorize:  ACCESS_MODE_OWNER,
@@ -147,8 +147,8 @@ func CreateOrganization(org, owner *User) (err error) {
147 147
 	}
148 148
 
149 149
 	if _, err = sess.Insert(&TeamUser{
150
-		Uid:    owner.Id,
151
-		OrgID:  org.Id,
150
+		Uid:    owner.ID,
151
+		OrgID:  org.ID,
152 152
 		TeamID: t.ID,
153 153
 	}); err != nil {
154 154
 		return fmt.Errorf("insert team-user relation: %v", err)
@@ -204,9 +204,9 @@ func DeleteOrganization(org *User) (err error) {
204 204
 	}
205 205
 
206 206
 	if err = deleteBeans(sess,
207
-		&Team{OrgID: org.Id},
208
-		&OrgUser{OrgID: org.Id},
209
-		&TeamUser{OrgID: org.Id},
207
+		&Team{OrgID: org.ID},
208
+		&OrgUser{OrgID: org.ID},
209
+		&TeamUser{OrgID: org.ID},
210 210
 	); err != nil {
211 211
 		return fmt.Errorf("deleteBeans: %v", err)
212 212
 	}
@@ -401,23 +401,23 @@ func RemoveOrgUser(orgId, uid int64) error {
401 401
 	}
402 402
 
403 403
 	// Delete all repository accesses.
404
-	access := &Access{UserID: u.Id}
404
+	access := &Access{UserID: u.ID}
405 405
 	for _, repo := range org.Repos {
406 406
 		access.RepoID = repo.ID
407 407
 		if _, err = sess.Delete(access); err != nil {
408 408
 			return err
409
-		} else if err = watchRepo(sess, u.Id, repo.ID, false); err != nil {
409
+		} else if err = watchRepo(sess, u.ID, repo.ID, false); err != nil {
410 410
 			return err
411 411
 		}
412 412
 	}
413 413
 
414 414
 	// Delete member in his/her teams.
415
-	teams, err := getUserTeams(sess, org.Id, u.Id)
415
+	teams, err := getUserTeams(sess, org.ID, u.ID)
416 416
 	if err != nil {
417 417
 		return err
418 418
 	}
419 419
 	for _, t := range teams {
420
-		if err = removeTeamMember(sess, org.Id, t.ID, u.Id); err != nil {
420
+		if err = removeTeamMember(sess, org.ID, t.ID, u.ID); err != nil {
421 421
 			return err
422 422
 		}
423 423
 	}
@@ -444,7 +444,7 @@ func (org *User) GetUserRepositories(userID int64) (err error) {
444 444
 	teams := make([]*Team, 0, org.NumTeams)
445 445
 	if err = x.Sql(`SELECT team.id FROM team
446 446
 INNER JOIN team_user ON team_user.team_id = team.id
447
-WHERE team_user.org_id = ? AND team_user.uid = ?`, org.Id, userID).Find(&teams); err != nil {
447
+WHERE team_user.org_id = ? AND team_user.uid = ?`, org.ID, userID).Find(&teams); err != nil {
448 448
 		return fmt.Errorf("get teams: %v", err)
449 449
 	}
450 450
 
@@ -461,7 +461,7 @@ WHERE team_user.org_id = ? AND team_user.uid = ?`, org.Id, userID).Find(&teams);
461 461
 	if err = x.Sql(fmt.Sprintf(`SELECT repository.* FROM repository
462 462
 INNER JOIN team_repo ON team_repo.repo_id = repository.id
463 463
 WHERE (repository.owner_id = ? AND repository.is_private = ?) OR team_repo.team_id IN (%s)
464
-GROUP BY repository.id`, strings.Join(teamIDs, ",")), org.Id, false).Find(&repos); err != nil {
464
+GROUP BY repository.id`, strings.Join(teamIDs, ",")), org.ID, false).Find(&repos); err != nil {
465 465
 		return fmt.Errorf("get repositories: %v", err)
466 466
 	}
467 467
 	org.Repos = repos
@@ -479,7 +479,7 @@ func (org *User) GetUserTeams(userID int64) error {
479 479
 	if err := x.Sql(`SELECT team.* FROM team
480 480
 INNER JOIN team_user ON team_user.team_id = team.id
481 481
 WHERE team_user.org_id = ? AND team_user.uid = ?`,
482
-		org.Id, userID).Find(&teams); err != nil {
482
+		org.ID, userID).Find(&teams); err != nil {
483 483
 		return fmt.Errorf("get teams: %v", err)
484 484
 	}
485 485
 

+ 4 - 4
models/org_team.go

@@ -106,7 +106,7 @@ func (t *Team) addRepository(e Engine, repo *Repository) (err error) {
106 106
 		return fmt.Errorf("getMembers: %v", err)
107 107
 	}
108 108
 	for _, u := range t.Members {
109
-		if err = watchRepo(e, u.Id, repo.ID, true); err != nil {
109
+		if err = watchRepo(e, u.ID, repo.ID, true); err != nil {
110 110
 			return fmt.Errorf("watchRepo: %v", err)
111 111
 		}
112 112
 	}
@@ -162,7 +162,7 @@ func (t *Team) removeRepository(e Engine, repo *Repository, recalculate bool) (e
162 162
 			continue
163 163
 		}
164 164
 
165
-		if err = watchRepo(e, u.Id, repo.ID, false); err != nil {
165
+		if err = watchRepo(e, u.ID, repo.ID, false); err != nil {
166 166
 			return err
167 167
 		}
168 168
 	}
@@ -341,7 +341,7 @@ func DeleteTeam(t *Team) error {
341 341
 	}
342 342
 
343 343
 	// Delete team-user.
344
-	if _, err = sess.Where("org_id=?", org.Id).Where("team_id=?", t.ID).Delete(new(TeamUser)); err != nil {
344
+	if _, err = sess.Where("org_id=?", org.ID).Where("team_id=?", t.ID).Delete(new(TeamUser)); err != nil {
345 345
 		return err
346 346
 	}
347 347
 
@@ -538,7 +538,7 @@ func removeTeamMember(e Engine, orgID, teamID, uid int64) error {
538 538
 
539 539
 	// This must exist.
540 540
 	ou := new(OrgUser)
541
-	_, err = e.Where("uid = ?", uid).And("org_id = ?", org.Id).Get(ou)
541
+	_, err = e.Where("uid = ?", uid).And("org_id = ?", org.ID).Get(ou)
542 542
 	if err != nil {
543 543
 		return err
544 544
 	}

+ 3 - 3
models/pull.go

@@ -163,7 +163,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
163 163
 
164 164
 	pr.HasMerged = true
165 165
 	pr.Merged = time.Now()
166
-	pr.MergerID = doer.Id
166
+	pr.MergerID = doer.ID
167 167
 	if _, err = sess.Id(pr.ID).AllCols().Update(pr); err != nil {
168 168
 		return fmt.Errorf("update pull request: %v", err)
169 169
 	}
@@ -245,7 +245,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error
245 245
 		},
246 246
 		Sender: &api.PayloadUser{
247 247
 			UserName:  doer.Name,
248
-			ID:        doer.Id,
248
+			ID:        doer.ID,
249 249
 			AvatarUrl: setting.AppUrl + doer.RelAvatarLink(),
250 250
 		},
251 251
 	}
@@ -332,7 +332,7 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str
332 332
 
333 333
 	// Notify watchers.
334 334
 	act := &Action{
335
-		ActUserID:    pull.Poster.Id,
335
+		ActUserID:    pull.Poster.ID,
336 336
 		ActUserName:  pull.Poster.Name,
337 337
 		ActEmail:     pull.Poster.Email,
338 338
 		OpType:       ACTION_CREATE_PULL_REQUEST,

+ 14 - 14
models/repo.go

@@ -476,7 +476,7 @@ func (repo *Repository) ComposePayload() *api.PayloadRepo {
476 476
 
477 477
 func isRepositoryExist(e Engine, u *User, repoName string) (bool, error) {
478 478
 	has, err := e.Get(&Repository{
479
-		OwnerID:   u.Id,
479
+		OwnerID:   u.ID,
480 480
 		LowerName: strings.ToLower(repoName),
481 481
 	})
482 482
 	return has && com.IsDir(RepoPath(u.Name, repoName)), err
@@ -958,7 +958,7 @@ func createRepository(e *xorm.Session, u *User, repo *Repository) (err error) {
958 958
 		}
959 959
 	}
960 960
 
961
-	if err = watchRepo(e, u.Id, repo.ID, true); err != nil {
961
+	if err = watchRepo(e, u.ID, repo.ID, true); err != nil {
962 962
 		return fmt.Errorf("watchRepo: %v", err)
963 963
 	} else if err = newRepoAction(e, u, repo); err != nil {
964 964
 		return fmt.Errorf("newRepoAction: %v", err)
@@ -974,7 +974,7 @@ func CreateRepository(u *User, opts CreateRepoOptions) (_ *Repository, err error
974 974
 	}
975 975
 
976 976
 	repo := &Repository{
977
-		OwnerID:      u.Id,
977
+		OwnerID:      u.ID,
978 978
 		Owner:        u,
979 979
 		Name:         opts.Name,
980 980
 		LowerName:    strings.ToLower(opts.Name),
@@ -1093,7 +1093,7 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
1093 1093
 
1094 1094
 	// Note: we have to set value here to make sure recalculate accesses is based on
1095 1095
 	//	new owner.
1096
-	repo.OwnerID = newOwner.Id
1096
+	repo.OwnerID = newOwner.ID
1097 1097
 	repo.Owner = newOwner
1098 1098
 
1099 1099
 	// Update repository.
@@ -1110,10 +1110,10 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
1110 1110
 	// Dummy object.
1111 1111
 	collaboration := &Collaboration{RepoID: repo.ID}
1112 1112
 	for _, c := range collaborators {
1113
-		collaboration.UserID = c.Id
1114
-		if c.Id == newOwner.Id || newOwner.IsOrgMember(c.Id) {
1113
+		collaboration.UserID = c.ID
1114
+		if c.ID == newOwner.ID || newOwner.IsOrgMember(c.ID) {
1115 1115
 			if _, err = sess.Delete(collaboration); err != nil {
1116
-				return fmt.Errorf("remove collaborator '%d': %v", c.Id, err)
1116
+				return fmt.Errorf("remove collaborator '%d': %v", c.ID, err)
1117 1117
 			}
1118 1118
 		}
1119 1119
 	}
@@ -1154,13 +1154,13 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
1154 1154
 	}
1155 1155
 
1156 1156
 	// Update repository count.
1157
-	if _, err = sess.Exec("UPDATE `user` SET num_repos=num_repos+1 WHERE id=?", newOwner.Id); err != nil {
1157
+	if _, err = sess.Exec("UPDATE `user` SET num_repos=num_repos+1 WHERE id=?", newOwner.ID); err != nil {
1158 1158
 		return fmt.Errorf("increase new owner repository count: %v", err)
1159
-	} else if _, err = sess.Exec("UPDATE `user` SET num_repos=num_repos-1 WHERE id=?", owner.Id); err != nil {
1159
+	} else if _, err = sess.Exec("UPDATE `user` SET num_repos=num_repos-1 WHERE id=?", owner.ID); err != nil {
1160 1160
 		return fmt.Errorf("decrease old owner repository count: %v", err)
1161 1161
 	}
1162 1162
 
1163
-	if err = watchRepo(sess, newOwner.Id, repo.ID, true); err != nil {
1163
+	if err = watchRepo(sess, newOwner.ID, repo.ID, true); err != nil {
1164 1164
 		return fmt.Errorf("watchRepo: %v", err)
1165 1165
 	} else if err = transferRepoAction(sess, u, owner, newOwner, repo); err != nil {
1166 1166
 		return fmt.Errorf("transferRepoAction: %v", err)
@@ -1200,7 +1200,7 @@ func ChangeRepositoryName(u *User, oldRepoName, newRepoName string) (err error)
1200 1200
 		return ErrRepoAlreadyExist{u.Name, newRepoName}
1201 1201
 	}
1202 1202
 
1203
-	repo, err := GetRepositoryByName(u.Id, oldRepoName)
1203
+	repo, err := GetRepositoryByName(u.ID, oldRepoName)
1204 1204
 	if err != nil {
1205 1205
 		return fmt.Errorf("GetRepositoryByName: %v", err)
1206 1206
 	}
@@ -1414,7 +1414,7 @@ func GetRepositoryByRef(ref string) (*Repository, error) {
1414 1414
 		return nil, err
1415 1415
 	}
1416 1416
 
1417
-	return GetRepositoryByName(user.Id, repoName)
1417
+	return GetRepositoryByName(user.ID, repoName)
1418 1418
 }
1419 1419
 
1420 1420
 // GetRepositoryByName returns the repository by given name under user if exists.
@@ -1467,7 +1467,7 @@ func GetRecentUpdatedRepositories(page, pageSize int) (repos []*Repository, err
1467 1467
 }
1468 1468
 
1469 1469
 func getRepositoryCount(e Engine, u *User) (int64, error) {
1470
-	return x.Count(&Repository{OwnerID: u.Id})
1470
+	return x.Count(&Repository{OwnerID: u.ID})
1471 1471
 }
1472 1472
 
1473 1473
 // GetRepositoryCount returns the total number of repositories of user.
@@ -2025,7 +2025,7 @@ func HasForkedRepo(ownerID, repoID int64) (*Repository, bool) {
2025 2025
 
2026 2026
 func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error) {
2027 2027
 	repo := &Repository{
2028
-		OwnerID:       u.Id,
2028
+		OwnerID:       u.ID,
2029 2029
 		Owner:         u,
2030 2030
 		Name:          name,
2031 2031
 		LowerName:     strings.ToLower(name),

+ 1 - 1
models/repo_collaboration.go

@@ -33,7 +33,7 @@ func (c *Collaboration) ModeI18nKey() string {
33 33
 func (repo *Repository) AddCollaborator(u *User) error {
34 34
 	collaboration := &Collaboration{
35 35
 		RepoID: repo.ID,
36
-		UserID: u.Id,
36
+		UserID: u.ID,
37 37
 	}
38 38
 
39 39
 	has, err := x.Get(collaboration)

+ 3 - 3
models/ssh_key.go

@@ -562,8 +562,8 @@ func DeletePublicKey(doer *User, id int64) (err error) {
562 562
 	}
563 563
 
564 564
 	// Check if user has access to delete this key.
565
-	if !doer.IsAdmin && doer.Id != key.OwnerID {
566
-		return ErrKeyAccessDenied{doer.Id, key.ID, "public"}
565
+	if !doer.IsAdmin && doer.ID != key.OwnerID {
566
+		return ErrKeyAccessDenied{doer.ID, key.ID, "public"}
567 567
 	}
568 568
 
569 569
 	sess := x.NewSession()
@@ -797,7 +797,7 @@ func DeleteDeployKey(doer *User, id int64) error {
797 797
 		if err != nil {
798 798
 			return fmt.Errorf("HasAccess: %v", err)
799 799
 		} else if !yes {
800
-			return ErrKeyAccessDenied{doer.Id, key.ID, "deploy"}
800
+			return ErrKeyAccessDenied{doer.ID, key.ID, "deploy"}
801 801
 		}
802 802
 	}
803 803
 

+ 3 - 3
models/update.go

@@ -108,7 +108,7 @@ func PushUpdate(opts PushUpdateOptions) (err error) {
108 108
 		return fmt.Errorf("GetUserByName: %v", err)
109 109
 	}
110 110
 
111
-	repo, err := GetRepositoryByName(repoUser.Id, opts.RepoName)
111
+	repo, err := GetRepositoryByName(repoUser.ID, opts.RepoName)
112 112
 	if err != nil {
113 113
 		return fmt.Errorf("GetRepositoryByName: %v", err)
114 114
 	}
@@ -133,7 +133,7 @@ func PushUpdate(opts PushUpdateOptions) (err error) {
133 133
 		}
134 134
 
135 135
 		commit := &PushCommits{}
136
-		if err = CommitRepoAction(opts.PusherID, repoUser.Id, opts.PusherName, actEmail,
136
+		if err = CommitRepoAction(opts.PusherID, repoUser.ID, opts.PusherName, actEmail,
137 137
 			repo.ID, opts.RepoUserName, opts.RepoName, opts.RefName, commit, opts.OldCommitID, opts.NewCommitID); err != nil {
138 138
 			return fmt.Errorf("CommitRepoAction (tag): %v", err)
139 139
 		}
@@ -159,7 +159,7 @@ func PushUpdate(opts PushUpdateOptions) (err error) {
159 159
 		}
160 160
 	}
161 161
 
162
-	if err = CommitRepoAction(opts.PusherID, repoUser.Id, opts.PusherName, repoUser.Email,
162
+	if err = CommitRepoAction(opts.PusherID, repoUser.ID, opts.PusherName, repoUser.Email,
163 163
 		repo.ID, opts.RepoUserName, opts.RepoName, opts.RefName, ListToPushCommits(l),
164 164
 		opts.OldCommitID, opts.NewCommitID); err != nil {
165 165
 		return fmt.Errorf("CommitRepoAction (branch): %v", err)

+ 43 - 43
models/user.go

@@ -52,7 +52,7 @@ var (
52 52
 
53 53
 // User represents the object of individual and member of organization.
54 54
 type User struct {
55
-	Id        int64
55
+	ID        int64  `xorm:"pk autoincr"`
56 56
 	LowerName string `xorm:"UNIQUE NOT NULL"`
57 57
 	Name      string `xorm:"UNIQUE NOT NULL"`
58 58
 	FullName  string
@@ -137,7 +137,7 @@ func (u *User) IsLocal() bool {
137 137
 
138 138
 // HasForkedRepo checks if user has already forked a repository with given ID.
139 139
 func (u *User) HasForkedRepo(repoID int64) bool {
140
-	_, has := HasForkedRepo(u.Id, repoID)
140
+	_, has := HasForkedRepo(u.ID, repoID)
141 141
 	return has
142 142
 }
143 143
 
@@ -184,7 +184,7 @@ func (u *User) HomeLink() string {
184 184
 // GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
185 185
 func (u *User) GenerateEmailActivateCode(email string) string {
186 186
 	code := base.CreateTimeLimitCode(
187
-		com.ToStr(u.Id)+email+u.LowerName+u.Passwd+u.Rands,
187
+		com.ToStr(u.ID)+email+u.LowerName+u.Passwd+u.Rands,
188 188
 		setting.Service.ActiveCodeLives, nil)
189 189
 
190 190
 	// Add tail hex username
@@ -199,7 +199,7 @@ func (u *User) GenerateActivateCode() string {
199 199
 
200 200
 // CustomAvatarPath returns user custom avatar file path.
201 201
 func (u *User) CustomAvatarPath() string {
202
-	return filepath.Join(setting.AvatarUploadPath, com.ToStr(u.Id))
202
+	return filepath.Join(setting.AvatarUploadPath, com.ToStr(u.ID))
203 203
 }
204 204
 
205 205
 // GenerateRandomAvatar generates a random avatar for user.
@@ -226,13 +226,13 @@ func (u *User) GenerateRandomAvatar() error {
226 226
 		return fmt.Errorf("Encode: %v", err)
227 227
 	}
228 228
 
229
-	log.Info("New random avatar created: %d", u.Id)
229
+	log.Info("New random avatar created: %d", u.ID)
230 230
 	return nil
231 231
 }
232 232
 
233 233
 func (u *User) RelAvatarLink() string {
234 234
 	defaultImgUrl := "/img/avatar_default.png"
235
-	if u.Id == -1 {
235
+	if u.ID == -1 {
236 236
 		return defaultImgUrl
237 237
 	}
238 238
 
@@ -241,7 +241,7 @@ func (u *User) RelAvatarLink() string {
241 241
 		if !com.IsExist(u.CustomAvatarPath()) {
242 242
 			return defaultImgUrl
243 243
 		}
244
-		return "/avatars/" + com.ToStr(u.Id)
244
+		return "/avatars/" + com.ToStr(u.ID)
245 245
 	case setting.DisableGravatar, setting.OfflineMode:
246 246
 		if !com.IsExist(u.CustomAvatarPath()) {
247 247
 			if err := u.GenerateRandomAvatar(); err != nil {
@@ -249,7 +249,7 @@ func (u *User) RelAvatarLink() string {
249 249
 			}
250 250
 		}
251 251
 
252
-		return "/avatars/" + com.ToStr(u.Id)
252
+		return "/avatars/" + com.ToStr(u.ID)
253 253
 	}
254 254
 	return setting.GravatarSource + u.Avatar
255 255
 }
@@ -266,7 +266,7 @@ func (u *User) AvatarLink() string {
266 266
 // User.GetFollwoers returns range of user's followers.
267 267
 func (u *User) GetFollowers(page int) ([]*User, error) {
268 268
 	users := make([]*User, 0, ItemsPerPage)
269
-	sess := x.Limit(ItemsPerPage, (page-1)*ItemsPerPage).Where("follow.follow_id=?", u.Id)
269
+	sess := x.Limit(ItemsPerPage, (page-1)*ItemsPerPage).Where("follow.follow_id=?", u.ID)
270 270
 	if setting.UsePostgreSQL {
271 271
 		sess = sess.Join("LEFT", "follow", `"user".id=follow.user_id`)
272 272
 	} else {
@@ -276,13 +276,13 @@ func (u *User) GetFollowers(page int) ([]*User, error) {
276 276
 }
277 277
 
278 278
 func (u *User) IsFollowing(followID int64) bool {
279
-	return IsFollowing(u.Id, followID)
279
+	return IsFollowing(u.ID, followID)
280 280
 }
281 281
 
282 282
 // GetFollowing returns range of user's following.
283 283
 func (u *User) GetFollowing(page int) ([]*User, error) {
284 284
 	users := make([]*User, 0, ItemsPerPage)
285
-	sess := x.Limit(ItemsPerPage, (page-1)*ItemsPerPage).Where("follow.user_id=?", u.Id)
285
+	sess := x.Limit(ItemsPerPage, (page-1)*ItemsPerPage).Where("follow.user_id=?", u.ID)
286 286
 	if setting.UsePostgreSQL {
287 287
 		sess = sess.Join("LEFT", "follow", `"user".id=follow.follow_id`)
288 288
 	} else {
@@ -350,7 +350,7 @@ func (u *User) UploadAvatar(data []byte) error {
350 350
 
351 351
 // DeleteAvatar deletes the user's custom avatar.
352 352
 func (u *User) DeleteAvatar() error {
353
-	log.Trace("DeleteAvatar[%d]: %s", u.Id, u.CustomAvatarPath())
353
+	log.Trace("DeleteAvatar[%d]: %s", u.ID, u.CustomAvatarPath())
354 354
 	os.Remove(u.CustomAvatarPath())
355 355
 
356 356
 	u.UseCustomAvatar = false
@@ -385,16 +385,16 @@ func (u *User) IsOrganization() bool {
385 385
 
386 386
 // IsUserOrgOwner returns true if user is in the owner team of given organization.
387 387
 func (u *User) IsUserOrgOwner(orgId int64) bool {
388
-	return IsOrganizationOwner(orgId, u.Id)
388
+	return IsOrganizationOwner(orgId, u.ID)
389 389
 }
390 390
 
391 391
 // IsPublicMember returns true if user public his/her membership in give organization.
392 392
 func (u *User) IsPublicMember(orgId int64) bool {
393
-	return IsPublicMembership(orgId, u.Id)
393
+	return IsPublicMembership(orgId, u.ID)
394 394
 }
395 395
 
396 396
 func (u *User) getOrganizationCount(e Engine) (int64, error) {
397
-	return e.Where("uid=?", u.Id).Count(new(OrgUser))
397
+	return e.Where("uid=?", u.ID).Count(new(OrgUser))
398 398
 }
399 399
 
400 400
 // GetOrganizationCount returns count of membership of organization of user.
@@ -404,19 +404,19 @@ func (u *User) GetOrganizationCount() (int64, error) {
404 404
 
405 405
 // GetRepositories returns all repositories that user owns, including private repositories.
406 406
 func (u *User) GetRepositories() (err error) {
407
-	u.Repos, err = GetRepositories(u.Id, true)
407
+	u.Repos, err = GetRepositories(u.ID, true)
408 408
 	return err
409 409
 }
410 410
 
411 411
 // GetOwnedOrganizations returns all organizations that user owns.
412 412
 func (u *User) GetOwnedOrganizations() (err error) {
413
-	u.OwnedOrgs, err = GetOwnedOrgsByUserID(u.Id)
413
+	u.OwnedOrgs, err = GetOwnedOrgsByUserID(u.ID)
414 414
 	return err
415 415
 }
416 416
 
417 417
 // GetOrganizations returns all organizations that user belongs to.
418 418
 func (u *User) GetOrganizations(all bool) error {
419
-	ous, err := GetOrgUsersByUserID(u.Id, all)
419
+	ous, err := GetOrgUsersByUserID(u.ID, all)
420 420
 	if err != nil {
421 421
 		return err
422 422
 	}
@@ -463,7 +463,7 @@ func GetUserSalt() string {
463 463
 // NewFakeUser creates and returns a fake user for someone has deleted his/her account.
464 464
 func NewFakeUser() *User {
465 465
 	return &User{
466
-		Id:        -1,
466
+		ID:        -1,
467 467
 		Name:      "Someone",
468 468
 		LowerName: "someone",
469 469
 	}
@@ -588,7 +588,7 @@ func VerifyUserActiveCode(code string) (user *User) {
588 588
 	if user = getVerifyUser(code); user != nil {
589 589
 		// time limit code
590 590
 		prefix := code[:base.TimeLimitCodeLength]
591
-		data := com.ToStr(user.Id) + user.Email + user.LowerName + user.Passwd + user.Rands
591
+		data := com.ToStr(user.ID) + user.Email + user.LowerName + user.Passwd + user.Rands
592 592
 
593 593
 		if base.VerifyTimeLimitCode(data, minutes, prefix) {
594 594
 			return user
@@ -604,7 +604,7 @@ func VerifyActiveEmailCode(code, email string) *EmailAddress {
604 604
 	if user := getVerifyUser(code); user != nil {
605 605
 		// time limit code
606 606
 		prefix := code[:base.TimeLimitCodeLength]
607
-		data := com.ToStr(user.Id) + email + user.LowerName + user.Passwd + user.Rands
607
+		data := com.ToStr(user.ID) + email + user.LowerName + user.Passwd + user.Rands
608 608
 
609 609
 		if base.VerifyTimeLimitCode(data, minutes, prefix) {
610 610
 			emailAddress := &EmailAddress{Email: email}
@@ -634,7 +634,7 @@ func ChangeUserName(u *User, newUserName string) (err error) {
634 634
 	}
635 635
 
636 636
 	// Delete all local copies of repository wiki that user owns.
637
-	if err = x.Where("owner_id=?", u.Id).Iterate(new(Repository), func(idx int, bean interface{}) error {
637
+	if err = x.Where("owner_id=?", u.ID).Iterate(new(Repository), func(idx int, bean interface{}) error {
638 638
 		repo := bean.(*Repository)
639 639
 		RemoveAllWithNotice("Delete repository wiki local copy", repo.LocalWikiPath())
640 640
 		return nil
@@ -649,7 +649,7 @@ func updateUser(e Engine, u *User) error {
649 649
 	// Organization does not need email
650 650
 	if !u.IsOrganization() {
651 651
 		u.Email = strings.ToLower(u.Email)
652
-		has, err := e.Where("id!=?", u.Id).And("type=?", u.Type).And("email=?", u.Email).Get(new(User))
652
+		has, err := e.Where("id!=?", u.ID).And("type=?", u.Type).And("email=?", u.Email).Get(new(User))
653 653
 		if err != nil {
654 654
 			return err
655 655
 		} else if has {
@@ -668,7 +668,7 @@ func updateUser(e Engine, u *User) error {
668 668
 	u.Description = base.TruncateString(u.Description, 255)
669 669
 
670 670
 	u.FullName = markdown.Sanitizer.Sanitize(u.FullName)
671
-	_, err := e.Id(u.Id).AllCols().Update(u)
671
+	_, err := e.Id(u.ID).AllCols().Update(u)
672 672
 	return err
673 673
 }
674 674
 
@@ -697,7 +697,7 @@ func deleteUser(e *xorm.Session, u *User) error {
697 697
 	if err != nil {
698 698
 		return fmt.Errorf("GetRepositoryCount: %v", err)
699 699
 	} else if count > 0 {
700
-		return ErrUserOwnRepos{UID: u.Id}
700
+		return ErrUserOwnRepos{UID: u.ID}
701 701
 	}
702 702
 
703 703
 	// Check membership of organization.
@@ -705,12 +705,12 @@ func deleteUser(e *xorm.Session, u *User) error {
705 705
 	if err != nil {
706 706
 		return fmt.Errorf("GetOrganizationCount: %v", err)
707 707
 	} else if count > 0 {
708
-		return ErrUserHasOrgs{UID: u.Id}
708
+		return ErrUserHasOrgs{UID: u.ID}
709 709
 	}
710 710
 
711 711
 	// ***** START: Watch *****
712 712
 	watches := make([]*Watch, 0, 10)
713
-	if err = e.Find(&watches, &Watch{UserID: u.Id}); err != nil {
713
+	if err = e.Find(&watches, &Watch{UserID: u.ID}); err != nil {
714 714
 		return fmt.Errorf("get all watches: %v", err)
715 715
 	}
716 716
 	for i := range watches {
@@ -722,7 +722,7 @@ func deleteUser(e *xorm.Session, u *User) error {
722 722
 
723 723
 	// ***** START: Star *****
724 724
 	stars := make([]*Star, 0, 10)
725
-	if err = e.Find(&stars, &Star{UID: u.Id}); err != nil {
725
+	if err = e.Find(&stars, &Star{UID: u.ID}); err != nil {
726 726
 		return fmt.Errorf("get all stars: %v", err)
727 727
 	}
728 728
 	for i := range stars {
@@ -734,7 +734,7 @@ func deleteUser(e *xorm.Session, u *User) error {
734 734
 
735 735
 	// ***** START: Follow *****
736 736
 	followers := make([]*Follow, 0, 10)
737
-	if err = e.Find(&followers, &Follow{UserID: u.Id}); err != nil {
737
+	if err = e.Find(&followers, &Follow{UserID: u.ID}); err != nil {
738 738
 		return fmt.Errorf("get all followers: %v", err)
739 739
 	}
740 740
 	for i := range followers {
@@ -745,22 +745,22 @@ func deleteUser(e *xorm.Session, u *User) error {
745 745
 	// ***** END: Follow *****
746 746
 
747 747
 	if err = deleteBeans(e,
748
-		&AccessToken{UID: u.Id},
749
-		&Collaboration{UserID: u.Id},
750
-		&Access{UserID: u.Id},
751
-		&Watch{UserID: u.Id},
752
-		&Star{UID: u.Id},
753
-		&Follow{FollowID: u.Id},
754
-		&Action{UserID: u.Id},
755
-		&IssueUser{UID: u.Id},
756
-		&EmailAddress{UID: u.Id},
748
+		&AccessToken{UID: u.ID},
749
+		&Collaboration{UserID: u.ID},
750
+		&Access{UserID: u.ID},
751
+		&Watch{UserID: u.ID},
752
+		&Star{UID: u.ID},
753
+		&Follow{FollowID: u.ID},
754
+		&Action{UserID: u.ID},
755
+		&IssueUser{UID: u.ID},
756
+		&EmailAddress{UID: u.ID},
757 757
 	); err != nil {
758 758
 		return fmt.Errorf("deleteBeans: %v", err)
759 759
 	}
760 760
 
761 761
 	// ***** START: PublicKey *****
762 762
 	keys := make([]*PublicKey, 0, 10)
763
-	if err = e.Find(&keys, &PublicKey{OwnerID: u.Id}); err != nil {
763
+	if err = e.Find(&keys, &PublicKey{OwnerID: u.ID}); err != nil {
764 764
 		return fmt.Errorf("get all public keys: %v", err)
765 765
 	}
766 766
 	for _, key := range keys {
@@ -771,11 +771,11 @@ func deleteUser(e *xorm.Session, u *User) error {
771 771
 	// ***** END: PublicKey *****
772 772
 
773 773
 	// Clear assignee.
774
-	if _, err = e.Exec("UPDATE `issue` SET assignee_id=0 WHERE assignee_id=?", u.Id); err != nil {
774
+	if _, err = e.Exec("UPDATE `issue` SET assignee_id=0 WHERE assignee_id=?", u.ID); err != nil {
775 775
 		return fmt.Errorf("clear assignee: %v", err)
776 776
 	}
777 777
 
778
-	if _, err = e.Id(u.Id).Delete(new(User)); err != nil {
778
+	if _, err = e.Id(u.ID).Delete(new(User)); err != nil {
779 779
 		return fmt.Errorf("Delete: %v", err)
780 780
 	}
781 781
 
@@ -861,7 +861,7 @@ func GetUserByID(id int64) (*User, error) {
861 861
 
862 862
 // GetAssigneeByID returns the user with write access of repository by given ID.
863 863
 func GetAssigneeByID(repo *Repository, userID int64) (*User, error) {
864
-	has, err := HasAccess(&User{Id: userID}, repo, ACCESS_MODE_WRITE)
864
+	has, err := HasAccess(&User{ID: userID}, repo, ACCESS_MODE_WRITE)
865 865
 	if err != nil {
866 866
 		return nil, err
867 867
 	} else if !has {
@@ -906,7 +906,7 @@ func GetUserIDsByNames(names []string) []int64 {
906 906
 		if err != nil {
907 907
 			continue
908 908
 		}
909
-		ids = append(ids, u.Id)
909
+		ids = append(ids, u.ID)
910 910
 	}
911 911
 	return ids
912 912
 }

+ 3 - 3
models/user_mail.go

@@ -160,7 +160,7 @@ func MakeEmailPrimary(email *EmailAddress) error {
160 160
 		return ErrEmailNotActivated
161 161
 	}
162 162
 
163
-	user := &User{Id: email.UID}
163
+	user := &User{ID: email.UID}
164 164
 	has, err = x.Get(user)
165 165
 	if err != nil {
166 166
 		return err
@@ -182,7 +182,7 @@ func MakeEmailPrimary(email *EmailAddress) error {
182 182
 	}
183 183
 
184 184
 	if !has {
185
-		formerPrimaryEmail.UID = user.Id
185
+		formerPrimaryEmail.UID = user.ID
186 186
 		formerPrimaryEmail.IsActivated = user.IsActive
187 187
 		if _, err = sess.Insert(formerPrimaryEmail); err != nil {
188 188
 			return err
@@ -190,7 +190,7 @@ func MakeEmailPrimary(email *EmailAddress) error {
190 190
 	}
191 191
 
192 192
 	user.Email = email.Email
193
-	if _, err = sess.Id(user.Id).AllCols().Update(user); err != nil {
193
+	if _, err = sess.Id(user.ID).AllCols().Update(user); err != nil {
194 194
 		return err
195 195
 	}
196 196
 

+ 1 - 1
modules/context/context.go

@@ -156,7 +156,7 @@ func Contexter() macaron.Handler {
156 156
 			ctx.IsSigned = true
157 157
 			ctx.Data["IsSigned"] = ctx.IsSigned
158 158
 			ctx.Data["SignedUser"] = ctx.User
159
-			ctx.Data["SignedUserID"] = ctx.User.Id
159
+			ctx.Data["SignedUserID"] = ctx.User.ID
160 160
 			ctx.Data["SignedUserName"] = ctx.User.Name
161 161
 			ctx.Data["IsAdmin"] = ctx.User.IsAdmin
162 162
 		} else {

+ 3 - 3
modules/context/org.go

@@ -72,13 +72,13 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
72 72
 		ctx.Org.IsTeamMember = true
73 73
 		ctx.Org.IsTeamAdmin = true
74 74
 	} else if ctx.IsSigned {
75
-		ctx.Org.IsOwner = org.IsOwnedBy(ctx.User.Id)
75
+		ctx.Org.IsOwner = org.IsOwnedBy(ctx.User.ID)
76 76
 		if ctx.Org.IsOwner {
77 77
 			ctx.Org.IsMember = true
78 78
 			ctx.Org.IsTeamMember = true
79 79
 			ctx.Org.IsTeamAdmin = true
80 80
 		} else {
81
-			if org.IsOrgMember(ctx.User.Id) {
81
+			if org.IsOrgMember(ctx.User.ID) {
82 82
 				ctx.Org.IsMember = true
83 83
 			}
84 84
 		}
@@ -105,7 +105,7 @@ func HandleOrgAssignment(ctx *Context, args ...bool) {
105 105
 				return
106 106
 			}
107 107
 		} else {
108
-			if err := org.GetUserTeams(ctx.User.Id); err != nil {
108
+			if err := org.GetUserTeams(ctx.User.ID); err != nil {
109 109
 				ctx.Handle(500, "GetUserTeams", err)
110 110
 				return
111 111
 			}

+ 3 - 3
modules/context/repo.go

@@ -122,7 +122,7 @@ func RepoAssignment(args ...bool) macaron.Handler {
122 122
 		ctx.Repo.Owner = owner
123 123
 
124 124
 		// Get repository.
125
-		repo, err := models.GetRepositoryByName(owner.Id, repoName)
125
+		repo, err := models.GetRepositoryByName(owner.ID, repoName)
126 126
 		if err != nil {
127 127
 			if models.IsErrRepoNotExist(err) {
128 128
 				ctx.Handle(404, "GetRepositoryByName", err)
@@ -198,8 +198,8 @@ func RepoAssignment(args ...bool) macaron.Handler {
198 198
 		ctx.Data["WikiCloneLink"] = repo.WikiCloneLink()
199 199
 
200 200
 		if ctx.IsSigned {
201
-			ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.Id, repo.ID)
202
-			ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.Id, repo.ID)
201
+			ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.ID, repo.ID)
202
+			ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.ID, repo.ID)
203 203
 		}
204 204
 
205 205
 		// repo is bare and display enable

+ 1 - 1
routers/admin/repos.go

@@ -39,7 +39,7 @@ func DeleteRepo(ctx *context.Context) {
39 39
 		return
40 40
 	}
41 41
 
42
-	if err := models.DeleteRepository(repo.MustOwner().Id, repo.ID); err != nil {
42
+	if err := models.DeleteRepository(repo.MustOwner().ID, repo.ID); err != nil {
43 43
 		ctx.Handle(500, "DeleteRepository", err)
44 44
 		return
45 45
 	}

+ 1 - 1
routers/admin/users.go

@@ -120,7 +120,7 @@ func NewUserPost(ctx *context.Context, form auth.AdminCrateUserForm) {
120 120
 	}
121 121
 
122 122
 	ctx.Flash.Success(ctx.Tr("admin.users.new_success", u.Name))
123
-	ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.Id))
123
+	ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.ID))
124 124
 }
125 125
 
126 126
 func prepareUserInfo(ctx *context.Context) *models.User {

+ 3 - 3
routers/api/v1/admin/org_team.go

@@ -15,7 +15,7 @@ import (
15 15
 
16 16
 func CreateTeam(ctx *context.APIContext, form api.CreateTeamOption) {
17 17
 	team := &models.Team{
18
-		OrgID:       ctx.Org.Organization.Id,
18
+		OrgID:       ctx.Org.Organization.ID,
19 19
 		Name:        form.Name,
20 20
 		Description: form.Description,
21 21
 		Authorize:   models.ParseAccessMode(form.Permission),
@@ -37,7 +37,7 @@ func AddTeamMember(ctx *context.APIContext) {
37 37
 	if ctx.Written() {
38 38
 		return
39 39
 	}
40
-	if err := ctx.Org.Team.AddMember(u.Id); err != nil {
40
+	if err := ctx.Org.Team.AddMember(u.ID); err != nil {
41 41
 		ctx.Error(500, "AddMember", err)
42 42
 		return
43 43
 	}
@@ -51,7 +51,7 @@ func RemoveTeamMember(ctx *context.APIContext) {
51 51
 		return
52 52
 	}
53 53
 
54
-	if err := ctx.Org.Team.RemoveMember(u.Id); err != nil {
54
+	if err := ctx.Org.Team.RemoveMember(u.ID); err != nil {
55 55
 		ctx.Error(500, "RemoveMember", err)
56 56
 		return
57 57
 	}

+ 1 - 1
routers/api/v1/admin/user.go

@@ -147,5 +147,5 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
147 147
 	if ctx.Written() {
148 148
 		return
149 149
 	}
150
-	user.CreateUserPublicKey(ctx, form, u.Id)
150
+	user.CreateUserPublicKey(ctx, form, u.ID)
151 151
 }

+ 1 - 1
routers/api/v1/api.go

@@ -49,7 +49,7 @@ func RepoAssignment() macaron.Handler {
49 49
 		ctx.Repo.Owner = owner
50 50
 
51 51
 		// Get repository.
52
-		repo, err := models.GetRepositoryByName(owner.Id, repoName)
52
+		repo, err := models.GetRepositoryByName(owner.ID, repoName)
53 53
 		if err != nil {
54 54
 			if models.IsErrRepoNotExist(err) {
55 55
 				ctx.Status(404)

+ 2 - 2
routers/api/v1/convert/convert.go

@@ -23,7 +23,7 @@ func ToUser(u *models.User) *api.User {
23 23
 	}
24 24
 
25 25
 	return &api.User{
26
-		ID:        u.Id,
26
+		ID:        u.ID,
27 27
 		UserName:  u.Name,
28 28
 		FullName:  u.FullName,
29 29
 		Email:     u.Email,
@@ -194,7 +194,7 @@ func ToIssue(issue *models.Issue) *api.Issue {
194 194
 
195 195
 func ToOrganization(org *models.User) *api.Organization {
196 196
 	return &api.Organization{
197
-		ID:          org.Id,
197
+		ID:          org.ID,
198 198
 		AvatarUrl:   org.AvatarLink(),
199 199
 		UserName:    org.Name,
200 200
 		FullName:    org.FullName,

+ 1 - 1
routers/api/v1/org/org.go

@@ -48,7 +48,7 @@ func Get(ctx *context.APIContext) {
48 48
 // https://github.com/gogits/go-gogs-client/wiki/Organizations#edit-an-organization
49 49
 func Edit(ctx *context.APIContext, form api.EditOrgOption) {
50 50
 	org := ctx.Org.Organization
51
-	if !org.IsOwnedBy(ctx.User.Id) {
51
+	if !org.IsOwnedBy(ctx.User.ID) {
52 52
 		ctx.Status(403)
53 53
 		return
54 54
 	}

+ 4 - 4
routers/api/v1/repo/issue.go

@@ -53,7 +53,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
53 53
 	issue := &models.Issue{
54 54
 		RepoID:   ctx.Repo.Repository.ID,
55 55
 		Name:     form.Title,
56
-		PosterID: ctx.User.Id,
56
+		PosterID: ctx.User.ID,
57 57
 		Poster:   ctx.User,
58 58
 		Content:  form.Body,
59 59
 	}
@@ -69,7 +69,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
69 69
 				}
70 70
 				return
71 71
 			}
72
-			issue.AssigneeID = assignee.Id
72
+			issue.AssigneeID = assignee.ID
73 73
 		}
74 74
 		issue.MilestoneID = form.Milestone
75 75
 	} else {
@@ -109,7 +109,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
109 109
 		return
110 110
 	}
111 111
 
112
-	if !issue.IsPoster(ctx.User.Id) && !ctx.Repo.IsWriter() {
112
+	if !issue.IsPoster(ctx.User.ID) && !ctx.Repo.IsWriter() {
113 113
 		ctx.Status(403)
114 114
 		return
115 115
 	}
@@ -135,7 +135,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
135 135
 				}
136 136
 				return
137 137
 			}
138
-			issue.AssigneeID = assignee.Id
138
+			issue.AssigneeID = assignee.ID
139 139
 		}
140 140
 
141 141
 		if err = models.UpdateIssueUserByAssignee(issue); err != nil {

+ 11 - 11
routers/api/v1/repo/repo.go

@@ -27,7 +27,7 @@ func Search(ctx *context.APIContext) {
27 27
 
28 28
 	// Check visibility.
29 29
 	if ctx.IsSigned && opts.OwnerID > 0 {
30
-		if ctx.User.Id == opts.OwnerID {
30
+		if ctx.User.ID == opts.OwnerID {
31 31
 			opts.Private = true
32 32
 		} else {
33 33
 			u, err := models.GetUserByID(opts.OwnerID)
@@ -38,7 +38,7 @@ func Search(ctx *context.APIContext) {
38 38
 				})
39 39
 				return
40 40
 			}
41
-			if u.IsOrganization() && u.IsOwnedBy(ctx.User.Id) {
41
+			if u.IsOrganization() && u.IsOwnedBy(ctx.User.ID) {
42 42
 				opts.Private = true
43 43
 			}
44 44
 			// FIXME: how about collaborators?
@@ -78,7 +78,7 @@ func Search(ctx *context.APIContext) {
78 78
 
79 79
 // https://github.com/gogits/go-gogs-client/wiki/Repositories#list-your-repositories
80 80
 func ListMyRepos(ctx *context.APIContext) {
81
-	ownRepos, err := models.GetRepositories(ctx.User.Id, true)
81
+	ownRepos, err := models.GetRepositories(ctx.User.ID, true)
82 82
 	if err != nil {
83 83
 		ctx.Error(500, "GetRepositories", err)
84 84
 		return
@@ -126,7 +126,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
126 126
 			ctx.Error(422, "", err)
127 127
 		} else {
128 128
 			if repo != nil {
129
-				if err = models.DeleteRepository(ctx.User.Id, repo.ID); err != nil {
129
+				if err = models.DeleteRepository(ctx.User.ID, repo.ID); err != nil {
130 130
 					log.Error(4, "DeleteRepository: %v", err)
131 131
 				}
132 132
 			}
@@ -159,7 +159,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
159 159
 		return
160 160
 	}
161 161
 
162
-	if !org.IsOwnedBy(ctx.User.Id) {
162
+	if !org.IsOwnedBy(ctx.User.ID) {
163 163
 		ctx.Error(403, "", "Given user is not owner of organization.")
164 164
 		return
165 165
 	}
@@ -171,7 +171,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
171 171
 	ctxUser := ctx.User
172 172
 	// Not equal means context user is an organization,
173 173
 	// or is another user/organization if current user is admin.
174
-	if form.Uid != ctxUser.Id {
174
+	if form.Uid != ctxUser.ID {
175 175
 		org, err := models.GetUserByID(form.Uid)
176 176
 		if err != nil {
177 177
 			if models.IsErrUserNotExist(err) {
@@ -191,7 +191,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
191 191
 
192 192
 	if ctxUser.IsOrganization() && !ctx.User.IsAdmin {
193 193
 		// Check ownership of organization.
194
-		if !ctxUser.IsOwnedBy(ctx.User.Id) {
194
+		if !ctxUser.IsOwnedBy(ctx.User.ID) {
195 195
 			ctx.Error(403, "", "Given user is not owner of organization.")
196 196
 			return
197 197
 		}
@@ -226,7 +226,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
226 226
 	})
227 227
 	if err != nil {
228 228
 		if repo != nil {
229
-			if errDelete := models.DeleteRepository(ctxUser.Id, repo.ID); errDelete != nil {
229
+			if errDelete := models.DeleteRepository(ctxUser.ID, repo.ID); errDelete != nil {
230 230
 				log.Error(4, "DeleteRepository: %v", errDelete)
231 231
 			}
232 232
 		}
@@ -249,7 +249,7 @@ func parseOwnerAndRepo(ctx *context.APIContext) (*models.User, *models.Repositor
249 249
 		return nil, nil
250 250
 	}
251 251
 
252
-	repo, err := models.GetRepositoryByName(owner.Id, ctx.Params(":reponame"))
252
+	repo, err := models.GetRepositoryByName(owner.ID, ctx.Params(":reponame"))
253 253
 	if err != nil {
254 254
 		if models.IsErrRepoNotExist(err) {
255 255
 			ctx.Status(404)
@@ -279,12 +279,12 @@ func Delete(ctx *context.APIContext) {
279 279
 		return
280 280
 	}
281 281
 
282
-	if owner.IsOrganization() && !owner.IsOwnedBy(ctx.User.Id) {
282
+	if owner.IsOrganization() && !owner.IsOwnedBy(ctx.User.ID) {
283 283
 		ctx.Error(403, "", "Given user is not owner of organization.")
284 284
 		return
285 285
 	}
286 286
 
287
-	if err := models.DeleteRepository(owner.Id, repo.ID); err != nil {
287
+	if err := models.DeleteRepository(owner.ID, repo.ID); err != nil {
288 288
 		ctx.Error(500, "DeleteRepository", err)
289 289
 		return
290 290
 	}

+ 2 - 2
routers/api/v1/user/app.go

@@ -13,7 +13,7 @@ import (
13 13
 
14 14
 // https://github.com/gogits/go-gogs-client/wiki/Users#list-access-tokens-for-a-user
15 15
 func ListAccessTokens(ctx *context.APIContext) {
16
-	tokens, err := models.ListAccessTokens(ctx.User.Id)
16
+	tokens, err := models.ListAccessTokens(ctx.User.ID)
17 17
 	if err != nil {
18 18
 		ctx.Error(500, "ListAccessTokens", err)
19 19
 		return
@@ -29,7 +29,7 @@ func ListAccessTokens(ctx *context.APIContext) {
29 29
 // https://github.com/gogits/go-gogs-client/wiki/Users#create-a-access-token
30 30
 func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) {
31 31
 	t := &models.AccessToken{
32
-		UID:  ctx.User.Id,
32
+		UID:  ctx.User.ID,
33 33
 		Name: form.Name,
34 34
 	}
35 35
 	if err := models.NewAccessToken(t); err != nil {

+ 2 - 2
routers/api/v1/user/email.go

@@ -15,7 +15,7 @@ import (
15 15
 
16 16
 // https://github.com/gogits/go-gogs-client/wiki/Users-Emails#list-email-addresses-for-a-user
17 17
 func ListEmails(ctx *context.APIContext) {
18
-	emails, err := models.GetEmailAddresses(ctx.User.Id)
18
+	emails, err := models.GetEmailAddresses(ctx.User.ID)
19 19
 	if err != nil {
20 20
 		ctx.Error(500, "GetEmailAddresses", err)
21 21
 		return
@@ -37,7 +37,7 @@ func AddEmail(ctx *context.APIContext, form api.CreateEmailOption) {
37 37
 	emails := make([]*models.EmailAddress, len(form.Emails))
38 38
 	for i := range form.Emails {
39 39
 		emails[i] = &models.EmailAddress{
40
-			UID:         ctx.User.Id,
40
+			UID:         ctx.User.ID,
41 41
 			Email:       form.Emails[i],
42 42
 			IsActivated: !setting.Service.RegisterEmailConfirm,
43 43
 		}

+ 4 - 4
routers/api/v1/user/follower.go

@@ -78,7 +78,7 @@ func CheckMyFollowing(ctx *context.APIContext) {
78 78
 	if ctx.Written() {
79 79
 		return
80 80
 	}
81
-	checkUserFollowing(ctx, ctx.User, target.Id)
81
+	checkUserFollowing(ctx, ctx.User, target.ID)
82 82
 }
83 83
 
84 84
 // https://github.com/gogits/go-gogs-client/wiki/Users-Followers#check-if-one-user-follows-another
@@ -91,7 +91,7 @@ func CheckFollowing(ctx *context.APIContext) {
91 91
 	if ctx.Written() {
92 92
 		return
93 93
 	}
94
-	checkUserFollowing(ctx, u, target.Id)
94
+	checkUserFollowing(ctx, u, target.ID)
95 95
 }
96 96
 
97 97
 // https://github.com/gogits/go-gogs-client/wiki/Users-Followers#follow-a-user
@@ -100,7 +100,7 @@ func Follow(ctx *context.APIContext) {
100 100
 	if ctx.Written() {
101 101
 		return
102 102
 	}
103
-	if err := models.FollowUser(ctx.User.Id, target.Id); err != nil {
103
+	if err := models.FollowUser(ctx.User.ID, target.ID); err != nil {
104 104
 		ctx.Error(500, "FollowUser", err)
105 105
 		return
106 106
 	}
@@ -113,7 +113,7 @@ func Unfollow(ctx *context.APIContext) {
113 113
 	if ctx.Written() {
114 114
 		return
115 115
 	}
116
-	if err := models.UnfollowUser(ctx.User.Id, target.Id); err != nil {
116
+	if err := models.UnfollowUser(ctx.User.ID, target.ID); err != nil {
117 117
 		ctx.Error(500, "UnfollowUser", err)
118 118
 		return
119 119
 	}

+ 3 - 3
routers/api/v1/user/key.go

@@ -54,7 +54,7 @@ func listPublicKeys(ctx *context.APIContext, uid int64) {
54 54
 
55 55
 // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#list-your-public-keys
56 56
 func ListMyPublicKeys(ctx *context.APIContext) {
57
-	listPublicKeys(ctx, ctx.User.Id)
57
+	listPublicKeys(ctx, ctx.User.ID)
58 58
 }
59 59
 
60 60
 // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#list-public-keys-for-a-user
@@ -63,7 +63,7 @@ func ListPublicKeys(ctx *context.APIContext) {
63 63
 	if ctx.Written() {
64 64
 		return
65 65
 	}
66
-	listPublicKeys(ctx, user.Id)
66
+	listPublicKeys(ctx, user.ID)
67 67
 }
68 68
 
69 69
 // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#get-a-single-public-key
@@ -101,7 +101,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid
101 101
 
102 102
 // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#create-a-public-key
103 103
 func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
104
-	CreateUserPublicKey(ctx, form, ctx.User.Id)
104
+	CreateUserPublicKey(ctx, form, ctx.User.ID)
105 105
 }
106 106
 
107 107
 // https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys#delete-a-public-key

+ 2 - 2
routers/api/v1/user/user.go

@@ -36,7 +36,7 @@ func Search(ctx *context.APIContext) {
36 36
 	results := make([]*api.User, len(users))
37 37
 	for i := range users {
38 38
 		results[i] = &api.User{
39
-			ID:        users[i].Id,
39
+			ID:        users[i].ID,
40 40
 			UserName:  users[i].Name,
41 41
 			AvatarUrl: users[i].AvatarLink(),
42 42
 			FullName:  users[i].FullName,
@@ -68,5 +68,5 @@ func GetInfo(ctx *context.APIContext) {
68 68
 	if !ctx.IsSigned {
69 69
 		u.Email = ""
70 70
 	}
71
-	ctx.JSON(200, &api.User{u.Id, u.Name, u.FullName, u.Email, u.AvatarLink()})
71
+	ctx.JSON(200, &api.User{u.ID, u.Name, u.FullName, u.Email, u.AvatarLink()})
72 72
 }

+ 1 - 1
routers/install.go

@@ -374,7 +374,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
374 374
 		}
375 375
 
376 376
 		// Auto-login for admin
377
-		ctx.Session.Set("uid", u.Id)
377
+		ctx.Session.Set("uid", u.ID)
378 378
 		ctx.Session.Set("uname", u.Name)
379 379
 	}
380 380
 

+ 6 - 6
routers/org/members.go

@@ -44,17 +44,17 @@ func MembersAction(ctx *context.Context) {
44 44
 	var err error
45 45
 	switch ctx.Params(":action") {
46 46
 	case "private":
47
-		if ctx.User.Id != uid && !ctx.Org.IsOwner {
47
+		if ctx.User.ID != uid && !ctx.Org.IsOwner {
48 48
 			ctx.Error(404)
49 49
 			return
50 50
 		}
51
-		err = models.ChangeOrgUserStatus(org.Id, uid, false)
51
+		err = models.ChangeOrgUserStatus(org.ID, uid, false)
52 52
 	case "public":
53
-		if ctx.User.Id != uid && !ctx.Org.IsOwner {
53
+		if ctx.User.ID != uid && !ctx.Org.IsOwner {
54 54
 			ctx.Error(404)
55 55
 			return
56 56
 		}
57
-		err = models.ChangeOrgUserStatus(org.Id, uid, true)
57
+		err = models.ChangeOrgUserStatus(org.ID, uid, true)
58 58
 	case "remove":
59 59
 		if !ctx.Org.IsOwner {
60 60
 			ctx.Error(404)
@@ -67,7 +67,7 @@ func MembersAction(ctx *context.Context) {
67 67
 			return
68 68
 		}
69 69
 	case "leave":
70
-		err = org.RemoveMember(ctx.User.Id)
70
+		err = org.RemoveMember(ctx.User.ID)
71 71
 		if models.IsErrLastOrgOwner(err) {
72 72
 			ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
73 73
 			ctx.Redirect(ctx.Org.OrgLink + "/members")
@@ -109,7 +109,7 @@ func Invitation(ctx *context.Context) {
109 109
 			return
110 110
 		}
111 111
 
112
-		if err = org.AddMember(u.Id); err != nil {
112
+		if err = org.AddMember(u.ID); err != nil {
113 113
 			ctx.Handle(500, " AddMember", err)
114 114
 			return
115 115
 		}

+ 3 - 3
routers/org/setting.go

@@ -41,7 +41,7 @@ func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
41 41
 
42 42
 	// Check if organization name has been changed.
43 43
 	if org.LowerName != strings.ToLower(form.Name) {
44
-		isExist, err := models.IsUserExist(org.Id, form.Name)
44
+		isExist, err := models.IsUserExist(org.ID, form.Name)
45 45
 		if err != nil {
46 46
 			ctx.Handle(500, "IsUserExist", err)
47 47
 			return
@@ -140,7 +140,7 @@ func Webhooks(ctx *context.Context) {
140 140
 	ctx.Data["BaseLink"] = ctx.Org.OrgLink
141 141
 	ctx.Data["Description"] = ctx.Tr("org.settings.hooks_desc")
142 142
 
143
-	ws, err := models.GetWebhooksByOrgID(ctx.Org.Organization.Id)
143
+	ws, err := models.GetWebhooksByOrgID(ctx.Org.Organization.ID)
144 144
 	if err != nil {
145 145
 		ctx.Handle(500, "GetWebhooksByOrgId", err)
146 146
 		return
@@ -151,7 +151,7 @@ func Webhooks(ctx *context.Context) {
151 151
 }
152 152
 
153 153
 func DeleteWebhook(ctx *context.Context) {
154
-	if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.Id, ctx.QueryInt64("id")); err != nil {
154
+	if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.ID, ctx.QueryInt64("id")); err != nil {
155 155
 		ctx.Flash.Error("DeleteWebhookByOrgID: " + err.Error())
156 156
 	} else {
157 157
 		ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success"))

+ 5 - 5
routers/org/teams.go

@@ -54,9 +54,9 @@ func TeamsAction(ctx *context.Context) {
54 54
 			ctx.Error(404)
55 55
 			return
56 56
 		}
57
-		err = ctx.Org.Team.AddMember(ctx.User.Id)
57
+		err = ctx.Org.Team.AddMember(ctx.User.ID)
58 58
 	case "leave":
59
-		err = ctx.Org.Team.RemoveMember(ctx.User.Id)
59
+		err = ctx.Org.Team.RemoveMember(ctx.User.ID)
60 60
 	case "remove":
61 61
 		if !ctx.Org.IsOwner {
62 62
 			ctx.Error(404)
@@ -82,7 +82,7 @@ func TeamsAction(ctx *context.Context) {
82 82
 			return
83 83
 		}
84 84
 
85
-		err = ctx.Org.Team.AddMember(u.Id)
85
+		err = ctx.Org.Team.AddMember(u.ID)
86 86
 		page = "team"
87 87
 	}
88 88
 
@@ -118,7 +118,7 @@ func TeamsRepoAction(ctx *context.Context) {
118 118
 	case "add":
119 119
 		repoName := path.Base(ctx.Query("repo_name"))
120 120
 		var repo *models.Repository
121
-		repo, err = models.GetRepositoryByName(ctx.Org.Organization.Id, repoName)
121
+		repo, err = models.GetRepositoryByName(ctx.Org.Organization.ID, repoName)
122 122
 		if err != nil {
123 123
 			if models.IsErrRepoNotExist(err) {
124 124
 				ctx.Flash.Error(ctx.Tr("org.teams.add_nonexistent_repo"))
@@ -155,7 +155,7 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
155 155
 	ctx.Data["PageIsOrgTeamsNew"] = true
156 156
 
157 157
 	t := &models.Team{
158
-		OrgID:       ctx.Org.Organization.Id,
158
+		OrgID:       ctx.Org.Organization.ID,
159 159
 		Name:        form.TeamName,
160 160
 		Description: form.Description,
161 161
 		Authorize:   models.ParseAccessMode(form.Permission),

+ 2 - 2
routers/repo/http.go

@@ -59,7 +59,7 @@ func HTTP(ctx *context.Context) {
59 59
 		return
60 60
 	}
61 61
 
62
-	repo, err := models.GetRepositoryByName(repoUser.Id, reponame)
62
+	repo, err := models.GetRepositoryByName(repoUser.ID, reponame)
63 63
 	if err != nil {
64 64
 		if models.IsErrRepoNotExist(err) {
65 65
 			ctx.Handle(http.StatusNotFound, "GetRepositoryByName", nil)
@@ -200,7 +200,7 @@ func HTTP(ctx *context.Context) {
200 200
 						RefName:      refName,
201 201
 						OldCommitID:  oldCommitId,
202 202
 						NewCommitID:  newCommitId,
203
-						PusherID:     authUser.Id,
203
+						PusherID:     authUser.ID,
204 204
 						PusherName:   authUser.Name,
205 205
 						RepoUserName: username,
206 206
 						RepoName:     reponame,

+ 12 - 12
routers/repo/issue.go

@@ -125,17 +125,17 @@ func Issues(ctx *context.Context) {
125 125
 	switch viewType {
126 126
 	case "assigned":
127 127
 		filterMode = models.FM_ASSIGN
128
-		assigneeID = ctx.User.Id
128
+		assigneeID = ctx.User.ID
129 129
 	case "created_by":
130 130
 		filterMode = models.FM_CREATE
131
-		posterID = ctx.User.Id
131
+		posterID = ctx.User.ID
132 132
 	case "mentioned":
133 133
 		filterMode = models.FM_MENTION
134 134
 	}
135 135
 
136 136
 	var uid int64 = -1
137 137
 	if ctx.IsSigned {
138
-		uid = ctx.User.Id
138
+		uid = ctx.User.ID
139 139
 	}
140 140
 
141 141
 	repo := ctx.Repo.Repository
@@ -200,7 +200,7 @@ func Issues(ctx *context.Context) {
200 200
 		}
201 201
 
202 202
 		// Check read status.
203
-		idx := models.PairsContains(pairs, issues[i].ID, ctx.User.Id)
203
+		idx := models.PairsContains(pairs, issues[i].ID, ctx.User.ID)
204 204
 		if idx > -1 {
205 205
 			issues[i].IsRead = pairs[idx].IsRead
206 206
 		} else {
@@ -425,7 +425,7 @@ func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) {
425 425
 	issue := &models.Issue{
426 426
 		RepoID:      repo.ID,
427 427
 		Name:        form.Title,
428
-		PosterID:    ctx.User.Id,
428
+		PosterID:    ctx.User.ID,
429 429
 		Poster:      ctx.User,
430 430
 		MilestoneID: milestoneID,
431 431
 		AssigneeID:  assigneeID,
@@ -581,7 +581,7 @@ func ViewIssue(ctx *context.Context) {
581 581
 
582 582
 	if ctx.IsSigned {
583 583
 		// Update issue-user.
584
-		if err = issue.ReadBy(ctx.User.Id); err != nil {
584
+		if err = issue.ReadBy(ctx.User.ID); err != nil {
585 585
 			ctx.Handle(500, "ReadBy", err)
586 586
 			return
587 587
 		}
@@ -627,7 +627,7 @@ func ViewIssue(ctx *context.Context) {
627 627
 					break
628 628
 				}
629 629
 			}
630
-			if !isAdded && !issue.IsPoster(comment.Poster.Id) {
630
+			if !isAdded && !issue.IsPoster(comment.Poster.ID) {
631 631
 				participants = append(participants, comment.Poster)
632 632
 			}
633 633
 		}
@@ -636,7 +636,7 @@ func ViewIssue(ctx *context.Context) {
636 636
 	ctx.Data["Participants"] = participants
637 637
 	ctx.Data["NumParticipants"] = len(participants)
638 638
 	ctx.Data["Issue"] = issue
639
-	ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.Id))
639
+	ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))
640 640
 	ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login"
641 641
 
642 642
 	ctx.Data["RequireHighlightJS"] = true
@@ -663,7 +663,7 @@ func UpdateIssueTitle(ctx *context.Context) {
663 663
 		return
664 664
 	}
665 665
 
666
-	if !ctx.IsSigned || (!issue.IsPoster(ctx.User.Id) && !ctx.Repo.IsWriter()) {
666
+	if !ctx.IsSigned || (!issue.IsPoster(ctx.User.ID) && !ctx.Repo.IsWriter()) {
667 667
 		ctx.Error(403)
668 668
 		return
669 669
 	}
@@ -690,7 +690,7 @@ func UpdateIssueContent(ctx *context.Context) {
690 690
 		return
691 691
 	}
692 692
 
693
-	if !ctx.IsSigned || (ctx.User.Id != issue.PosterID && !ctx.Repo.IsWriter()) {
693
+	if !ctx.IsSigned || (ctx.User.ID != issue.PosterID && !ctx.Repo.IsWriter()) {
694 694
 		ctx.Error(403)
695 695
 		return
696 696
 	}
@@ -831,7 +831,7 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
831 831
 	var comment *models.Comment
832 832
 	defer func() {
833 833
 		// Check if issue admin/poster changes the status of issue.
834
-		if (ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.Id))) &&
834
+		if (ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))) &&
835 835
 			(form.Status == "reopen" || form.Status == "close") &&
836 836
 			!(issue.IsPull && issue.HasMerged) {
837 837
 
@@ -907,7 +907,7 @@ func UpdateCommentContent(ctx *context.Context) {
907 907
 		return
908 908
 	}
909 909
 
910
-	if !ctx.IsSigned || (ctx.User.Id != comment.PosterID && !ctx.Repo.IsAdmin()) {
910
+	if !ctx.IsSigned || (ctx.User.ID != comment.PosterID && !ctx.Repo.IsAdmin()) {
911 911
 		ctx.Error(403)
912 912
 		return
913 913
 	} else if comment.Type != models.COMMENT_TYPE_COMMENT {

+ 5 - 5
routers/repo/pull.go

@@ -104,7 +104,7 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
104 104
 		return
105 105
 	}
106 106
 
107
-	repo, has := models.HasForkedRepo(ctxUser.Id, forkRepo.ID)
107
+	repo, has := models.HasForkedRepo(ctxUser.ID, forkRepo.ID)
108 108
 	if has {
109 109
 		ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
110 110
 		return
@@ -112,7 +112,7 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
112 112
 
113 113
 	// Check ownership of organization.
114 114
 	if ctxUser.IsOrganization() {
115
-		if !ctxUser.IsOwnedBy(ctx.User.Id) {
115
+		if !ctxUser.IsOwnedBy(ctx.User.ID) {
116 116
 			ctx.Error(403)
117 117
 			return
118 118
 		}
@@ -166,7 +166,7 @@ func checkPullInfo(ctx *context.Context) *models.Issue {
166 166
 
167 167
 	if ctx.IsSigned {
168 168
 		// Update issue-user.
169
-		if err = issue.ReadBy(ctx.User.Id); err != nil {
169
+		if err = issue.ReadBy(ctx.User.ID); err != nil {
170 170
 			ctx.Handle(500, "ReadBy", err)
171 171
 			return nil
172 172
 		}
@@ -478,7 +478,7 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *
478 478
 	}
479 479
 
480 480
 	// Check if current user has fork of repository or in the same repository.
481
-	headRepo, has := models.HasForkedRepo(headUser.Id, baseRepo.ID)
481
+	headRepo, has := models.HasForkedRepo(headUser.ID, baseRepo.ID)
482 482
 	if !has && !isSameRepo {
483 483
 		log.Trace("ParseCompareInfo[%d]: does not have fork or in same repository", baseRepo.ID)
484 484
 		ctx.Handle(404, "ParseCompareInfo", nil)
@@ -666,7 +666,7 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
666 666
 		RepoID:      repo.ID,
667 667
 		Index:       repo.NextIssueIndex(),
668 668
 		Name:        form.Title,
669
-		PosterID:    ctx.User.Id,
669
+		PosterID:    ctx.User.ID,
670 670
 		Poster:      ctx.User,
671 671
 		MilestoneID: milestoneID,
672 672
 		AssigneeID:  assigneeID,

+ 1 - 1
routers/repo/release.go

@@ -176,7 +176,7 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
176 176
 
177 177
 	rel := &models.Release{
178 178
 		RepoID:       ctx.Repo.Repository.ID,
179
-		PublisherID:  ctx.User.Id,
179
+		PublisherID:  ctx.User.ID,
180 180
 		Title:        form.Title,
181 181
 		TagName:      form.TagName,
182 182
 		Target:       form.Target,

+ 9 - 9
routers/repo/repo.go

@@ -34,7 +34,7 @@ func MustBeNotBare(ctx *context.Context) {
34 34
 }
35 35
 
36 36
 func checkContextUser(ctx *context.Context, uid int64) *models.User {
37
-	orgs, err := models.GetOwnedOrgsByUserIDDesc(ctx.User.Id, "updated_unix")
37
+	orgs, err := models.GetOwnedOrgsByUserIDDesc(ctx.User.ID, "updated_unix")
38 38
 	if err != nil {
39 39
 		ctx.Handle(500, "GetOwnedOrgsByUserIDDesc", err)
40 40
 		return nil
@@ -42,7 +42,7 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User {
42 42
 	ctx.Data["Orgs"] = orgs
43 43
 
44 44
 	// Not equal means current user is an organization.
45
-	if uid == ctx.User.Id || uid == 0 {
45
+	if uid == ctx.User.ID || uid == 0 {
46 46
 		return ctx.User
47 47
 	}
48 48
 
@@ -57,7 +57,7 @@ func checkContextUser(ctx *context.Context, uid int64) *models.User {
57 57
 	}
58 58
 
59 59
 	// Check ownership of organization.
60
-	if !org.IsOrganization() || !(ctx.User.IsAdmin || org.IsOwnedBy(ctx.User.Id)) {
60
+	if !org.IsOrganization() || !(ctx.User.IsAdmin || org.IsOwnedBy(ctx.User.ID)) {
61 61
 		ctx.Error(403)
62 62
 		return nil
63 63
 	}
@@ -136,7 +136,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
136 136
 	}
137 137
 
138 138
 	if repo != nil {
139
-		if errDelete := models.DeleteRepository(ctxUser.Id, repo.ID); errDelete != nil {
139
+		if errDelete := models.DeleteRepository(ctxUser.ID, repo.ID); errDelete != nil {
140 140
 			log.Error(4, "DeleteRepository: %v", errDelete)
141 141
 		}
142 142
 	}
@@ -208,7 +208,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
208 208
 	}
209 209
 
210 210
 	if repo != nil {
211
-		if errDelete := models.DeleteRepository(ctxUser.Id, repo.ID); errDelete != nil {
211
+		if errDelete := models.DeleteRepository(ctxUser.ID, repo.ID); errDelete != nil {
212 212
 			log.Error(4, "DeleteRepository: %v", errDelete)
213 213
 		}
214 214
 	}
@@ -231,13 +231,13 @@ func Action(ctx *context.Context) {
231 231
 	var err error
232 232
 	switch ctx.Params(":action") {
233 233
 	case "watch":
234
-		err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.ID, true)
234
+		err = models.WatchRepo(ctx.User.ID, ctx.Repo.Repository.ID, true)
235 235
 	case "unwatch":
236
-		err = models.WatchRepo(ctx.User.Id, ctx.Repo.Repository.ID, false)
236
+		err = models.WatchRepo(ctx.User.ID, ctx.Repo.Repository.ID, false)
237 237
 	case "star":
238
-		err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.ID, true)
238
+		err = models.StarRepo(ctx.User.ID, ctx.Repo.Repository.ID, true)
239 239
 	case "unstar":
240
-		err = models.StarRepo(ctx.User.Id, ctx.Repo.Repository.ID, false)
240
+		err = models.StarRepo(ctx.User.ID, ctx.Repo.Repository.ID, false)
241 241
 	case "desc": // FIXME: this is not used
242 242
 		if !ctx.Repo.IsOwner() {
243 243
 			ctx.Error(404)

+ 7 - 7
routers/repo/setting.go

@@ -162,7 +162,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
162 162
 		}
163 163
 
164 164
 		if ctx.Repo.Owner.IsOrganization() {
165
-			if !ctx.Repo.Owner.IsOwnedBy(ctx.User.Id) {
165
+			if !ctx.Repo.Owner.IsOwnedBy(ctx.User.ID) {
166 166
 				ctx.Error(404)
167 167
 				return
168 168
 			}
@@ -196,7 +196,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
196 196
 		}
197 197
 
198 198
 		if ctx.Repo.Owner.IsOrganization() {
199
-			if !ctx.Repo.Owner.IsOwnedBy(ctx.User.Id) {
199
+			if !ctx.Repo.Owner.IsOwnedBy(ctx.User.ID) {
200 200
 				ctx.Error(404)
201 201
 				return
202 202
 			}
@@ -235,13 +235,13 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
235 235
 		}
236 236
 
237 237
 		if ctx.Repo.Owner.IsOrganization() {
238
-			if !ctx.Repo.Owner.IsOwnedBy(ctx.User.Id) {
238
+			if !ctx.Repo.Owner.IsOwnedBy(ctx.User.ID) {
239 239
 				ctx.Error(404)
240 240
 				return
241 241
 			}
242 242
 		}
243 243
 
244
-		if err := models.DeleteRepository(ctx.Repo.Owner.Id, repo.ID); err != nil {
244
+		if err := models.DeleteRepository(ctx.Repo.Owner.ID, repo.ID); err != nil {
245 245
 			ctx.Handle(500, "DeleteRepository", err)
246 246
 			return
247 247
 		}
@@ -261,7 +261,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
261 261
 		}
262 262
 
263 263
 		if ctx.Repo.Owner.IsOrganization() {
264
-			if !ctx.Repo.Owner.IsOwnedBy(ctx.User.Id) {
264
+			if !ctx.Repo.Owner.IsOwnedBy(ctx.User.ID) {
265 265
 				ctx.Error(404)
266 266
 				return
267 267
 			}
@@ -321,7 +321,7 @@ func CollaborationPost(ctx *context.Context) {
321 321
 	}
322 322
 
323 323
 	// Check if user is organization member.
324
-	if ctx.Repo.Owner.IsOrganization() && ctx.Repo.Owner.IsOrgMember(u.Id) {
324
+	if ctx.Repo.Owner.IsOrganization() && ctx.Repo.Owner.IsOrgMember(u.ID) {
325 325
 		ctx.Flash.Info(ctx.Tr("repo.settings.user_is_org_member"))
326 326
 		ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration")
327 327
 		return
@@ -371,7 +371,7 @@ func parseOwnerAndRepo(ctx *context.Context) (*models.User, *models.Repository)
371 371
 		return nil, nil
372 372
 	}
373 373
 
374
-	repo, err := models.GetRepositoryByName(owner.Id, ctx.Params(":reponame"))
374
+	repo, err := models.GetRepositoryByName(owner.ID, ctx.Params(":reponame"))
375 375
 	if err != nil {
376 376
 		if models.IsErrRepoNotExist(err) {
377 377
 			ctx.Handle(404, "GetRepositoryByName", err)

+ 3 - 3
routers/repo/webhook.go

@@ -63,7 +63,7 @@ func getOrgRepoCtx(ctx *context.Context) (*OrgRepoCtx, error) {
63 63
 
64 64
 	if len(ctx.Org.OrgLink) > 0 {
65 65
 		return &OrgRepoCtx{
66
-			OrgID:       ctx.Org.Organization.Id,
66
+			OrgID:       ctx.Org.Organization.ID,
67 67
 			Link:        ctx.Org.OrgLink,
68 68
 			NewTemplate: ORG_HOOK_NEW,
69 69
 		}, nil
@@ -224,7 +224,7 @@ func checkWebhook(ctx *context.Context) (*OrgRepoCtx, *models.Webhook) {
224 224
 	if orCtx.RepoID > 0 {
225 225
 		w, err = models.GetWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
226 226
 	} else {
227
-		w, err = models.GetWebhookByOrgID(ctx.Org.Organization.Id, ctx.ParamsInt64(":id"))
227
+		w, err = models.GetWebhookByOrgID(ctx.Org.Organization.ID, ctx.ParamsInt64(":id"))
228 228
 	}
229 229
 	if err != nil {
230 230
 		if models.IsErrWebhookNotExist(err) {
@@ -369,7 +369,7 @@ func TestWebhook(ctx *context.Context) {
369 369
 		},
370 370
 		Sender: &api.PayloadUser{
371 371
 			UserName:  ctx.User.Name,
372
-			ID:        ctx.User.Id,
372
+			ID:        ctx.User.ID,
373 373
 			AvatarUrl: ctx.User.AvatarLink(),
374 374
 		},
375 375
 	}

+ 4 - 4
routers/user/auth.go

@@ -60,7 +60,7 @@ func AutoSignIn(ctx *context.Context) (bool, error) {
60 60
 	}
61 61
 
62 62
 	isSucceed = true
63
-	ctx.Session.Set("uid", u.Id)
63
+	ctx.Session.Set("uid", u.ID)
64 64
 	ctx.Session.Set("uname", u.Name)
65 65
 	ctx.SetCookie(setting.CSRFCookieName, "", -1, setting.AppSubUrl)
66 66
 	return true, nil
@@ -114,7 +114,7 @@ func SignInPost(ctx *context.Context, form auth.SignInForm) {
114 114
 			setting.CookieRememberName, u.Name, days, setting.AppSubUrl)
115 115
 	}
116 116
 
117
-	ctx.Session.Set("uid", u.Id)
117
+	ctx.Session.Set("uid", u.ID)
118 118
 	ctx.Session.Set("uname", u.Name)
119 119
 
120 120
 	// Clear whatever CSRF has right now, force to generate a new one
@@ -220,7 +220,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
220 220
 	}
221 221
 
222 222
 	// Send confirmation email, no need for social account.
223
-	if setting.Service.RegisterEmailConfirm && u.Id > 1 {
223
+	if setting.Service.RegisterEmailConfirm && u.ID > 1 {
224 224
 		models.SendActivateAccountMail(ctx.Context, u)
225 225
 		ctx.Data["IsSendRegisterMail"] = true
226 226
 		ctx.Data["Email"] = u.Email
@@ -278,7 +278,7 @@ func Activate(ctx *context.Context) {
278 278
 
279 279
 		log.Trace("User activated: %s", user.Name)
280 280
 
281
-		ctx.Session.Set("uid", user.Id)
281
+		ctx.Session.Set("uid", user.ID)
282 282
 		ctx.Session.Set("uname", user.Name)
283 283
 		ctx.Redirect(setting.AppSubUrl + "/")
284 284
 		return

+ 21 - 16
routers/user/home.go

@@ -24,6 +24,7 @@ const (
24 24
 	ORG_HOME  base.TplName = "org/home"
25 25
 )
26 26
 
27
+// getDashboardContextUser finds out dashboard is viewing as which context user.
27 28
 func getDashboardContextUser(ctx *context.Context) *models.User {
28 29
 	ctxUser := ctx.User
29 30
 	orgName := ctx.Params(":org")
@@ -51,6 +52,9 @@ func getDashboardContextUser(ctx *context.Context) *models.User {
51 52
 	return ctxUser
52 53
 }
53 54
 
55
+// retrieveFeeds loads feeds from database by given context user.
56
+// The user could be organization so it is not always the logged in user,
57
+// which is why we have to explicitly pass the context user ID.
54 58
 func retrieveFeeds(ctx *context.Context, ctxUserID, userID, offset int64, isProfile bool) {
55 59
 	actions, err := models.GetFeeds(ctxUserID, userID, offset, isProfile)
56 60
 	if err != nil {
@@ -84,14 +88,15 @@ func retrieveFeeds(ctx *context.Context, ctxUserID, userID, offset int64, isProf
84 88
 
85 89
 func Dashboard(ctx *context.Context) {
86 90
 	ctxUser := getDashboardContextUser(ctx)
87
-	ctx.Data["Title"] = ctxUser.DisplayName() + " - " + ctx.Tr("dashboard")
88
-	ctx.Data["PageIsDashboard"] = true
89
-	ctx.Data["PageIsNews"] = true
90
-
91 91
 	if ctx.Written() {
92 92
 		return
93 93
 	}
94 94
 
95
+	ctx.Data["Title"] = ctxUser.DisplayName() + " - " + ctx.Tr("dashboard")
96
+	ctx.Data["PageIsDashboard"] = true
97
+	ctx.Data["PageIsNews"] = true
98
+
99
+	// Only user can have collaborative repositories.
95 100
 	if !ctxUser.IsOrganization() {
96 101
 		collaborateRepos, err := ctx.User.GetAccessibleRepositories()
97 102
 		if err != nil {
@@ -111,14 +116,14 @@ func Dashboard(ctx *context.Context) {
111 116
 
112 117
 	var repos []*models.Repository
113 118
 	if ctxUser.IsOrganization() {
114
-		if err := ctxUser.GetUserRepositories(ctx.User.Id); err != nil {
119
+		if err := ctxUser.GetUserRepositories(ctx.User.ID); err != nil {
115 120
 			ctx.Handle(500, "GetUserRepositories", err)
116 121
 			return
117 122
 		}
118 123
 		repos = ctxUser.Repos
119 124
 	} else {
120 125
 		var err error
121
-		repos, err = models.GetRepositories(ctxUser.Id, true)
126
+		repos, err = models.GetRepositories(ctxUser.ID, true)
122 127
 		if err != nil {
123 128
 			ctx.Handle(500, "GetRepositories", err)
124 129
 			return
@@ -140,7 +145,7 @@ func Dashboard(ctx *context.Context) {
140 145
 	ctx.Data["MirrorCount"] = len(mirrors)
141 146
 	ctx.Data["Mirrors"] = mirrors
142 147
 
143
-	retrieveFeeds(ctx, ctxUser.Id, ctx.User.Id, 0, false)
148
+	retrieveFeeds(ctx, ctxUser.ID, ctx.User.ID, 0, false)
144 149
 	if ctx.Written() {
145 150
 		return
146 151
 	}
@@ -182,10 +187,10 @@ func Issues(ctx *context.Context) {
182 187
 		switch viewType {
183 188
 		case "assigned":
184 189
 			filterMode = models.FM_ASSIGN
185
-			assigneeID = ctxUser.Id
190
+			assigneeID = ctxUser.ID
186 191
 		case "created_by":
187 192
 			filterMode = models.FM_CREATE
188
-			posterID = ctxUser.Id
193
+			posterID = ctxUser.ID
189 194
 		}
190 195
 	}
191 196
 
@@ -194,7 +199,7 @@ func Issues(ctx *context.Context) {
194 199
 
195 200
 	// Get repositories.
196 201
 	if ctxUser.IsOrganization() {
197
-		if err := ctxUser.GetUserRepositories(ctx.User.Id); err != nil {
202
+		if err := ctxUser.GetUserRepositories(ctx.User.ID); err != nil {
198 203
 			ctx.Handle(500, "GetRepositories", err)
199 204
 			return
200 205
 		}
@@ -227,7 +232,7 @@ func Issues(ctx *context.Context) {
227 232
 
228 233
 		if filterMode != models.FM_ALL {
229 234
 			// Calculate repository issue count with filter mode.
230
-			numOpen, numClosed := repo.IssueStats(ctxUser.Id, filterMode, isPullList)
235
+			numOpen, numClosed := repo.IssueStats(ctxUser.ID, filterMode, isPullList)
231 236
 			repo.NumOpenIssues, repo.NumClosedIssues = int(numOpen), int(numClosed)
232 237
 		}
233 238
 
@@ -239,7 +244,7 @@ func Issues(ctx *context.Context) {
239 244
 	}
240 245
 	ctx.Data["Repos"] = showRepos
241 246
 
242
-	issueStats := models.GetUserIssueStats(repoID, ctxUser.Id, repoIDs, filterMode, isPullList)
247
+	issueStats := models.GetUserIssueStats(repoID, ctxUser.ID, repoIDs, filterMode, isPullList)
243 248
 	issueStats.AllCount = int64(allCount)
244 249
 
245 250
 	page := ctx.QueryInt("page")
@@ -257,7 +262,7 @@ func Issues(ctx *context.Context) {
257 262
 
258 263
 	// Get issues.
259 264
 	issues, err := models.Issues(&models.IssuesOptions{
260
-		UserID:     ctxUser.Id,
265
+		UserID:     ctxUser.ID,
261 266
 		AssigneeID: assigneeID,
262 267
 		RepoID:     repoID,
263 268
 		PosterID:   posterID,
@@ -328,21 +333,21 @@ func showOrgProfile(ctx *context.Context) {
328 333
 
329 334
 	if ctx.IsSigned {
330 335
 		if ctx.User.IsAdmin {
331
-			repos, err := models.GetRepositories(org.Id, true)
336
+			repos, err := models.GetRepositories(org.ID, true)
332 337
 			if err != nil {
333 338
 				ctx.Handle(500, "GetRepositoriesAsAdmin", err)
334 339
 				return
335 340
 			}
336 341
 			ctx.Data["Repos"] = repos
337 342
 		} else {
338
-			if err := org.GetUserRepositories(ctx.User.Id); err != nil {
343
+			if err := org.GetUserRepositories(ctx.User.ID); err != nil {
339 344
 				ctx.Handle(500, "GetUserRepositories", err)
340 345
 				return
341 346
 			}
342 347
 			ctx.Data["Repos"] = org.Repos
343 348
 		}
344 349
 	} else {
345
-		repos, err := models.GetRepositories(org.Id, false)
350
+		repos, err := models.GetRepositories(org.ID, false)
346 351
 		if err != nil {
347 352
 			ctx.Handle(500, "GetRepositories", err)
348 353
 			return

+ 6 - 6
routers/user/profile.go

@@ -62,7 +62,7 @@ func Profile(ctx *context.Context) {
62 62
 
63 63
 	// Show SSH keys.
64 64
 	if isShowKeys {
65
-		ShowSSHKeys(ctx, u.Id)
65
+		ShowSSHKeys(ctx, u.ID)
66 66
 		return
67 67
 	}
68 68
 
@@ -75,7 +75,7 @@ func Profile(ctx *context.Context) {
75 75
 	ctx.Data["PageIsUserProfile"] = true
76 76
 	ctx.Data["Owner"] = u
77 77
 
78
-	orgs, err := models.GetOrgsByUserID(u.Id, ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.Id == u.Id))
78
+	orgs, err := models.GetOrgsByUserID(u.ID, ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == u.ID))
79 79
 	if err != nil {
80 80
 		ctx.Handle(500, "GetOrgsByUserIDDesc", err)
81 81
 		return
@@ -87,13 +87,13 @@ func Profile(ctx *context.Context) {
87 87
 	ctx.Data["TabName"] = tab
88 88
 	switch tab {
89 89
 	case "activity":
90
-		retrieveFeeds(ctx, u.Id, -1, 0, true)
90
+		retrieveFeeds(ctx, u.ID, -1, 0, true)
91 91
 		if ctx.Written() {
92 92
 			return
93 93
 		}
94 94
 	default:
95 95
 		var err error
96
-		ctx.Data["Repos"], err = models.GetRepositories(u.Id, ctx.IsSigned && ctx.User.Id == u.Id)
96
+		ctx.Data["Repos"], err = models.GetRepositories(u.ID, ctx.IsSigned && ctx.User.ID == u.ID)
97 97
 		if err != nil {
98 98
 			ctx.Handle(500, "GetRepositories", err)
99 99
 			return
@@ -140,9 +140,9 @@ func Action(ctx *context.Context) {
140 140
 	var err error
141 141
 	switch ctx.Params(":action") {
142 142
 	case "follow":
143
-		err = models.FollowUser(ctx.User.Id, u.Id)
143
+		err = models.FollowUser(ctx.User.ID, u.ID)
144 144
 	case "unfollow":
145
-		err = models.UnfollowUser(ctx.User.Id, u.Id)
145
+		err = models.UnfollowUser(ctx.User.ID, u.ID)
146 146
 	}
147 147
 
148 148
 	if err != nil {

+ 10 - 10
routers/user/setting.go

@@ -131,7 +131,7 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.UploadAvatarForm, ctxUs
131 131
 		// generate a random one when needed.
132 132
 		if form.Enable && !com.IsFile(ctxUser.CustomAvatarPath()) {
133 133
 			if err := ctxUser.GenerateRandomAvatar(); err != nil {
134
-				log.Error(4, "GenerateRandomAvatar[%d]: %v", ctxUser.Id, err)
134
+				log.Error(4, "GenerateRandomAvatar[%d]: %v", ctxUser.ID, err)
135 135
 			}
136 136
 		}
137 137
 	}
@@ -199,7 +199,7 @@ func SettingsEmails(ctx *context.Context) {
199 199
 	ctx.Data["Title"] = ctx.Tr("settings")
200 200
 	ctx.Data["PageIsSettingsEmails"] = true
201 201
 
202
-	emails, err := models.GetEmailAddresses(ctx.User.Id)
202
+	emails, err := models.GetEmailAddresses(ctx.User.ID)
203 203
 	if err != nil {
204 204
 		ctx.Handle(500, "GetEmailAddresses", err)
205 205
 		return
@@ -226,7 +226,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
226 226
 	}
227 227
 
228 228
 	// Add Email address.
229
-	emails, err := models.GetEmailAddresses(ctx.User.Id)
229
+	emails, err := models.GetEmailAddresses(ctx.User.ID)
230 230
 	if err != nil {
231 231
 		ctx.Handle(500, "GetEmailAddresses", err)
232 232
 		return
@@ -239,7 +239,7 @@ func SettingsEmailPost(ctx *context.Context, form auth.AddEmailForm) {
239 239
 	}
240 240
 
241 241
 	email := &models.EmailAddress{
242
-		UID:         ctx.User.Id,
242
+		UID:         ctx.User.ID,
243 243
 		Email:       form.Email,
244 244
 		IsActivated: !setting.Service.RegisterEmailConfirm,
245 245
 	}
@@ -285,7 +285,7 @@ func SettingsSSHKeys(ctx *context.Context) {
285 285
 	ctx.Data["Title"] = ctx.Tr("settings")
286 286
 	ctx.Data["PageIsSettingsSSHKeys"] = true
287 287
 
288
-	keys, err := models.ListPublicKeys(ctx.User.Id)
288
+	keys, err := models.ListPublicKeys(ctx.User.ID)
289 289
 	if err != nil {
290 290
 		ctx.Handle(500, "ListPublicKeys", err)
291 291
 		return
@@ -299,7 +299,7 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
299 299
 	ctx.Data["Title"] = ctx.Tr("settings")
300 300
 	ctx.Data["PageIsSettingsSSHKeys"] = true
301 301
 
302
-	keys, err := models.ListPublicKeys(ctx.User.Id)
302
+	keys, err := models.ListPublicKeys(ctx.User.ID)
303 303
 	if err != nil {
304 304
 		ctx.Handle(500, "ListPublicKeys", err)
305 305
 		return
@@ -322,7 +322,7 @@ func SettingsSSHKeysPost(ctx *context.Context, form auth.AddSSHKeyForm) {
322 322
 		}
323 323
 	}
324 324
 
325
-	if _, err = models.AddPublicKey(ctx.User.Id, form.Title, content); err != nil {
325
+	if _, err = models.AddPublicKey(ctx.User.ID, form.Title, content); err != nil {
326 326
 		ctx.Data["HasError"] = true
327 327
 		switch {
328 328
 		case models.IsErrKeyAlreadyExist(err):
@@ -357,7 +357,7 @@ func SettingsApplications(ctx *context.Context) {
357 357
 	ctx.Data["Title"] = ctx.Tr("settings")
358 358
 	ctx.Data["PageIsSettingsApplications"] = true
359 359
 
360
-	tokens, err := models.ListAccessTokens(ctx.User.Id)
360
+	tokens, err := models.ListAccessTokens(ctx.User.ID)
361 361
 	if err != nil {
362 362
 		ctx.Handle(500, "ListAccessTokens", err)
363 363
 		return
@@ -372,7 +372,7 @@ func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm
372 372
 	ctx.Data["PageIsSettingsApplications"] = true
373 373
 
374 374
 	if ctx.HasError() {
375
-		tokens, err := models.ListAccessTokens(ctx.User.Id)
375
+		tokens, err := models.ListAccessTokens(ctx.User.ID)
376 376
 		if err != nil {
377 377
 			ctx.Handle(500, "ListAccessTokens", err)
378 378
 			return
@@ -383,7 +383,7 @@ func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm
383 383
 	}
384 384
 
385 385
 	t := &models.AccessToken{
386
-		UID:  ctx.User.Id,
386
+		UID:  ctx.User.ID,
387 387
 		Name: form.Name,
388 388
 	}
389 389
 	if err := models.NewAccessToken(t); err != nil {

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
1
-0.9.52.0723
1
+0.9.53.0724

+ 1 - 1
templates/admin/base/page.tmpl

@@ -20,4 +20,4 @@
20 20
 				</div>
21 21
 			</div>
22 22
 		{{end}}
23
-	{{end}}
23
+	{{end}}

+ 1 - 1
templates/admin/base/search.tmpl

@@ -3,4 +3,4 @@
3 3
 	  <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "explore.search"}}..." autofocus>
4 4
 	  <button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
5 5
 	</div>
6
-</form>
6
+</form>

+ 1 - 1
templates/admin/org/list.tmpl

@@ -27,7 +27,7 @@
27 27
 						<tbody>
28 28
 							{{range .Users}}
29 29
 								<tr>
30
-									<td>{{.Id}}</td>
30
+									<td>{{.ID}}</td>
31 31
 									<td><a href="{{.HomeLink}}">{{.Name}}</a></td>
32 32
 									<td>{{.NumTeams}}</td>
33 33
 									<td>{{.NumMembers}}</td>

+ 1 - 1
templates/admin/user/edit.tmpl

@@ -102,7 +102,7 @@
102 102
 
103 103
 						<div class="field">
104 104
 							<button class="ui green button">{{.i18n.Tr "admin.users.update_profile"}}</button>
105
-							<div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.User.Id}}">{{.i18n.Tr "admin.users.delete_account"}}</div>
105
+							<div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.User.ID}}">{{.i18n.Tr "admin.users.delete_account"}}</div>
106 106
 						</div>
107 107
 					</form>
108 108
 				</div>

+ 2 - 2
templates/admin/user/list.tmpl

@@ -31,14 +31,14 @@
31 31
 						<tbody>
32 32
 							{{range .Users}}
33 33
 								<tr>
34
-									<td>{{.Id}}</td>
34
+									<td>{{.ID}}</td>
35 35
 									<td><a href="{{AppSubUrl}}/{{.Name}}">{{.Name}}</a></td>
36 36
 									<td><span class="text truncate email">{{.Email}}</span></td>
37 37
 									<td><i class="fa fa{{if .IsActive}}-check{{end}}-square-o"></i></td>
38 38
 									<td><i class="fa fa{{if .IsAdmin}}-check{{end}}-square-o"></i></td>
39 39
 									<td>{{.NumRepos}}</td>
40 40
 									<td><span title="{{DateFmtLong .Created}}">{{DateFmtShort .Created }}</span></td>
41
-									<td><a href="{{$.Link}}/{{.Id}}"><i class="fa fa-pencil-square-o"></i></a></td>
41
+									<td><a href="{{$.Link}}/{{.ID}}"><i class="fa fa-pencil-square-o"></i></a></td>
42 42
 								</tr>
43 43
 							{{end}}
44 44
 						</tbody>

+ 1 - 1
templates/explore/page.tmpl

@@ -18,4 +18,4 @@
18 18
 			</div>
19 19
 		</div>
20 20
 	{{end}}
21
-{{end}}
21
+{{end}}

+ 1 - 1
templates/explore/search.tmpl

@@ -4,4 +4,4 @@
4 4
 	  <button class="ui blue button">{{.i18n.Tr "explore.search"}}</button>
5 5
 	</div>
6 6
 </form>
7
-<div class="ui divider"></div>
7
+<div class="ui divider"></div>

+ 1 - 1
templates/mail/issue/mention.tmpl

@@ -14,4 +14,4 @@
14 14
 		<a href="{{.Link}}">View it on Gogs</a>.
15 15
 	</p>
16 16
 </body>
17
-</html>
17
+</html>

+ 2 - 2
templates/org/home.tmpl

@@ -27,7 +27,7 @@
27 27
 			<div class="ui eleven wide column">
28 28
 				{{if .IsOrganizationOwner}}
29 29
 					<div class="text right">
30
-						<a class="ui green button" href="{{AppSubUrl}}/repo/create?org={{.Org.Id}}"><i class="octicon octicon-repo-create"></i> {{.i18n.Tr "new_repo"}}</a>
30
+						<a class="ui green button" href="{{AppSubUrl}}/repo/create?org={{.Org.ID}}"><i class="octicon octicon-repo-create"></i> {{.i18n.Tr "new_repo"}}</a>
31 31
 					</div>
32 32
 					<div class="ui divider"></div>
33 33
 				{{end}}
@@ -46,7 +46,7 @@
46 46
 				<div class="ui attached segment members">
47 47
 					{{$isMember := .IsOrganizationMember}}
48 48
 					{{range .Members}}
49
-						{{if or $isMember (.IsPublicMember $.Org.Id)}}
49
+						{{if or $isMember (.IsPublicMember $.Org.ID)}}
50 50
 							<a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}"><img class="ui avatar" src="{{.AvatarLink}}"></a>
51 51
 						{{end}}
52 52
 					{{end}}

+ 7 - 7
templates/org/member/members.tmpl

@@ -25,13 +25,13 @@
25 25
 							{{$.i18n.Tr "org.members.membership_visibility"}}
26 26
 						</div>
27 27
 						<div class="meta">
28
-							{{ $isPublic := .IsPublicMember $.Org.Id}}
28
+							{{ $isPublic := .IsPublicMember $.Org.ID}}
29 29
 							{{if $isPublic}}
30 30
 								<strong>{{$.i18n.Tr "org.members.public"}}</strong>
31
-								{{if or (eq $.SignedUser.Id .Id) $.IsOrganizationOwner}}(<a href="{{$.OrgLink}}/members/action/private?uid={{.Id}}">{{$.i18n.Tr "org.members.public_helper"}}</a>){{end}}
31
+								{{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}}(<a href="{{$.OrgLink}}/members/action/private?uid={{.ID}}">{{$.i18n.Tr "org.members.public_helper"}}</a>){{end}}
32 32
 							{{else}}
33 33
 								<strong>{{$.i18n.Tr "org.members.private"}}</strong>
34
-								{{if or (eq $.SignedUser.Id .Id) $.IsOrganizationOwner}}(<a href="{{$.OrgLink}}/members/action/public?uid={{.Id}}">{{$.i18n.Tr "org.members.private_helper"}}</a>){{end}}
34
+								{{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}}(<a href="{{$.OrgLink}}/members/action/public?uid={{.ID}}">{{$.i18n.Tr "org.members.private_helper"}}</a>){{end}}
35 35
 							{{end}}
36 36
 						</div>
37 37
 					</div>
@@ -40,15 +40,15 @@
40 40
 							{{$.i18n.Tr "org.members.member_role"}}
41 41
 						</div>
42 42
 						<div class="meta">
43
-							<strong>{{if .IsUserOrgOwner $.Org.Id}}<span class="octicon octicon-shield"></span> {{$.i18n.Tr "org.members.owner"}}{{else}}{{$.i18n.Tr "org.members.member"}}{{end}}</strong>
43
+							<strong>{{if .IsUserOrgOwner $.Org.ID}}<span class="octicon octicon-shield"></span> {{$.i18n.Tr "org.members.owner"}}{{else}}{{$.i18n.Tr "org.members.member"}}{{end}}</strong>
44 44
 						</div>
45 45
 					</div>
46 46
 					<div class="ui four wide column">
47 47
 						<div class="text right">
48
-							{{if eq $.SignedUser.Id .Id}}
49
-								<a class="ui red small button" href="{{$.OrgLink}}/members/action/leave?uid={{.Id}}">{{$.i18n.Tr "org.members.leave"}}</a>
48
+							{{if eq $.SignedUser.ID .ID}}
49
+								<a class="ui red small button" href="{{$.OrgLink}}/members/action/leave?uid={{.ID}}">{{$.i18n.Tr "org.members.leave"}}</a>
50 50
 							{{else if $.IsOrganizationOwner}}
51
-								<a class="ui red small button" href="{{$.OrgLink}}/members/action/remove?uid={{.Id}}">{{$.i18n.Tr "org.members.remove"}}</a>
51
+								<a class="ui red small button" href="{{$.OrgLink}}/members/action/remove?uid={{.ID}}">{{$.i18n.Tr "org.members.remove"}}</a>
52 52
 							{{end}}
53 53
 						</div>
54 54
 					</div>

+ 2 - 2
templates/org/team/members.tmpl

@@ -13,7 +13,7 @@
13 13
 					{{range .Team.Members}}
14 14
 						<div class="item">
15 15
 							{{if $.IsOrganizationOwner}}
16
-								<a class="ui red small button right" href="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/remove?uid={{.Id}}">{{$.i18n.Tr "org.members.remove"}}</a>
16
+								<a class="ui red small button right" href="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/remove?uid={{.ID}}">{{$.i18n.Tr "org.members.remove"}}</a>
17 17
 							{{end}}
18 18
 							<a href="{{.HomeLink}}">
19 19
 								<img class="ui avatar image" src="{{.AvatarLink}}">
@@ -26,7 +26,7 @@
26 26
 					<div class="ui bottom attached segment">
27 27
 						<form class="ui form" id="add-member-form" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/add" method="post">
28 28
 							{{.CsrfTokenHtml}}
29
-							<input type="hidden" name="uid" value="{{.SignedUser.Id}}">
29
+							<input type="hidden" name="uid" value="{{.SignedUser.ID}}">
30 30
 							<div class="inline field ui left">
31 31
 								<div id="search-user-box">
32 32
 									<div class="ui input">

+ 1 - 1
templates/org/team/repositories.tmpl

@@ -28,7 +28,7 @@
28 28
 						<form class="ui form" id="add-repo-form" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/add" method="post">
29 29
 							{{.CsrfTokenHtml}}
30 30
 							<div class="inline field ui left">
31
-								<div id="search-repo-box" data-uid="{{.Org.Id}}">
31
+								<div id="search-repo-box" data-uid="{{.Org.ID}}">
32 32
 									<div class="ui input">
33 33
 										<input class="prompt" name="repo_name" placeholder="{{.i18n.Tr "org.teams.search_repo_placeholder"}}" autocomplete="off" required>
34 34
 									</div>

+ 3 - 3
templates/org/team/sidebar.tmpl

@@ -2,10 +2,10 @@
2 2
 	<h4 class="ui top attached header">
3 3
 		<strong>{{.Team.Name}}</strong>
4 4
 		<div class="ui right">
5
-			{{if .Team.IsMember $.SignedUser.Id}}
6
-				<a class="ui red tiny button" href="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/leave?uid={{$.SignedUser.Id}}&page=team">{{$.i18n.Tr "org.teams.leave"}}</a>
5
+			{{if .Team.IsMember $.SignedUser.ID}}
6
+				<a class="ui red tiny button" href="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/leave?uid={{$.SignedUser.ID}}&page=team">{{$.i18n.Tr "org.teams.leave"}}</a>