Unknwon пре 6 година
родитељ
комит
77275a9b31

+ 1 - 1
models/comment.go

@@ -500,7 +500,7 @@ func DeleteCommentByID(doer *User, id int64) error {
 		return err
 	}
 
-	if _, err = sess.Id(comment.ID).Delete(new(Comment)); err != nil {
+	if _, err = sess.ID(comment.ID).Delete(new(Comment)); err != nil {
 		return err
 	}
 

+ 4 - 4
models/issue.go

@@ -402,7 +402,7 @@ func (i *Issue) ReadBy(uid int64) error {
 }
 
 func updateIssueCols(e Engine, issue *Issue, cols ...string) error {
-	_, err := e.Id(issue.ID).Cols(cols...).Update(issue)
+	_, err := e.ID(issue.ID).Cols(cols...).Update(issue)
 	return err
 }
 
@@ -843,7 +843,7 @@ func GetIssueByIndex(repoID, index int64) (*Issue, error) {
 
 func getRawIssueByID(e Engine, id int64) (*Issue, error) {
 	issue := new(Issue)
-	has, err := e.Id(id).Get(issue)
+	has, err := e.ID(id).Get(issue)
 	if err != nil {
 		return nil, err
 	} else if !has {
@@ -1354,7 +1354,7 @@ func GetRepoIssueStats(repoID, userID int64, filterMode FilterMode, isPull bool)
 }
 
 func updateIssue(e Engine, issue *Issue) error {
-	_, err := e.Id(issue.ID).AllCols().Update(issue)
+	_, err := e.ID(issue.ID).AllCols().Update(issue)
 	return err
 }
 
@@ -1423,7 +1423,7 @@ func updateIssueUsersByMentions(e Engine, issueID int64, uids []int64) error {
 
 		iu.IsMentioned = true
 		if has {
-			_, err = e.Id(iu.ID).AllCols().Update(iu)
+			_, err = e.ID(iu.ID).AllCols().Update(iu)
 		} else {
 			_, err = e.Insert(iu)
 		}

+ 2 - 2
models/issue_label.go

@@ -196,7 +196,7 @@ func GetLabelsByIssueID(issueID int64) ([]*Label, error) {
 }
 
 func updateLabel(e Engine, l *Label) error {
-	_, err := e.Id(l.ID).AllCols().Update(l)
+	_, err := e.ID(l.ID).AllCols().Update(l)
 	return err
 }
 
@@ -221,7 +221,7 @@ func DeleteLabel(repoID, labelID int64) error {
 		return err
 	}
 
-	if _, err = sess.Id(labelID).Delete(new(Label)); err != nil {
+	if _, err = sess.ID(labelID).Delete(new(Label)); err != nil {
 		return err
 	} else if _, err = sess.Where("label_id = ?", labelID).Delete(new(IssueLabel)); err != nil {
 		return err

+ 1 - 1
models/migrations/migrations.go

@@ -162,7 +162,7 @@ func generateOrgRandsAndSalt(x *xorm.Engine) (err error) {
 		if org.Salt, err = tool.RandomString(10); err != nil {
 			return err
 		}
-		if _, err = sess.Id(org.ID).Update(org); err != nil {
+		if _, err = sess.ID(org.ID).Update(org); err != nil {
 			return err
 		}
 	}

+ 4 - 4
models/milestone.go

@@ -166,7 +166,7 @@ func GetMilestones(repoID int64, page int, isClosed bool) ([]*Milestone, error)
 }
 
 func updateMilestone(e Engine, m *Milestone) error {
-	_, err := e.Id(m.ID).AllCols().Update(m)
+	_, err := e.ID(m.ID).AllCols().Update(m)
 	return err
 }
 
@@ -223,7 +223,7 @@ func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error) {
 
 	repo.NumMilestones = int(countRepoMilestones(sess, repo.ID))
 	repo.NumClosedMilestones = int(countRepoClosedMilestones(sess, repo.ID))
-	if _, err = sess.Id(repo.ID).AllCols().Update(repo); err != nil {
+	if _, err = sess.ID(repo.ID).AllCols().Update(repo); err != nil {
 		return err
 	}
 	return sess.Commit()
@@ -383,13 +383,13 @@ func DeleteMilestoneOfRepoByID(repoID, id int64) error {
 		return err
 	}
 
-	if _, err = sess.Id(m.ID).Delete(new(Milestone)); err != nil {
+	if _, err = sess.ID(m.ID).Delete(new(Milestone)); err != nil {
 		return err
 	}
 
 	repo.NumMilestones = int(countRepoMilestones(sess, repo.ID))
 	repo.NumClosedMilestones = int(countRepoClosedMilestones(sess, repo.ID))
-	if _, err = sess.Id(repo.ID).AllCols().Update(repo); err != nil {
+	if _, err = sess.ID(repo.ID).AllCols().Update(repo); err != nil {
 		return err
 	}
 

+ 1 - 1
models/mirror.go

@@ -320,7 +320,7 @@ func GetMirrorByRepoID(repoID int64) (*Mirror, error) {
 }
 
 func updateMirror(e Engine, m *Mirror) error {
-	_, err := e.Id(m.ID).AllCols().Update(m)
+	_, err := e.ID(m.ID).AllCols().Update(m)
 	return err
 }
 

+ 1 - 1
models/models.go

@@ -33,7 +33,7 @@ type Engine interface {
 	Exec(string, ...interface{}) (sql.Result, error)
 	Find(interface{}, ...interface{}) error
 	Get(interface{}) (bool, error)
-	Id(interface{}) *xorm.Session
+	ID(interface{}) *xorm.Session
 	In(string, ...interface{}) *xorm.Session
 	Insert(...interface{}) (int64, error)
 	InsertOne(interface{}) (int64, error)

+ 1 - 1
models/org.go

@@ -410,7 +410,7 @@ func RemoveOrgUser(orgID, userID int64) error {
 		return err
 	}
 
-	if _, err := sess.Id(ou.ID).Delete(ou); err != nil {
+	if _, err := sess.ID(ou.ID).Delete(ou); err != nil {
 		return err
 	} else if _, err = sess.Exec("UPDATE `user` SET num_members=num_members-1 WHERE id=?", orgID); err != nil {
 		return err

+ 10 - 10
models/org_team.go

@@ -111,7 +111,7 @@ func (t *Team) addRepository(e Engine, repo *Repository) (err error) {
 	}
 
 	t.NumRepos++
-	if _, err = e.Id(t.ID).AllCols().Update(t); err != nil {
+	if _, err = e.ID(t.ID).AllCols().Update(t); err != nil {
 		return fmt.Errorf("update team: %v", err)
 	}
 
@@ -157,7 +157,7 @@ func (t *Team) removeRepository(e Engine, repo *Repository, recalculate bool) (e
 	}
 
 	t.NumRepos--
-	if _, err = e.Id(t.ID).AllCols().Update(t); err != nil {
+	if _, err = e.ID(t.ID).AllCols().Update(t); err != nil {
 		return err
 	}
 
@@ -286,7 +286,7 @@ func GetTeamOfOrgByName(orgID int64, name string) (*Team, error) {
 
 func getTeamByID(e Engine, teamID int64) (*Team, error) {
 	t := new(Team)
-	has, err := e.Id(teamID).Get(t)
+	has, err := e.ID(teamID).Get(t)
 	if err != nil {
 		return nil, err
 	} else if !has {
@@ -334,7 +334,7 @@ func UpdateTeam(t *Team, authChanged bool) (err error) {
 		return ErrTeamAlreadyExist{t.OrgID, t.LowerName}
 	}
 
-	if _, err = sess.Id(t.ID).AllCols().Update(t); err != nil {
+	if _, err = sess.ID(t.ID).AllCols().Update(t); err != nil {
 		return fmt.Errorf("update: %v", err)
 	}
 
@@ -386,7 +386,7 @@ func DeleteTeam(t *Team) error {
 	}
 
 	// Delete team.
-	if _, err = sess.Id(t.ID).Delete(new(Team)); err != nil {
+	if _, err = sess.ID(t.ID).Delete(new(Team)); err != nil {
 		return err
 	}
 	// Update organization number of teams.
@@ -431,7 +431,7 @@ func getTeamMembers(e Engine, teamID int64) (_ []*User, err error) {
 	members := make([]*User, 0, len(teamUsers))
 	for i := range teamUsers {
 		member := new(User)
-		if _, err = e.Id(teamUsers[i].UID).Get(member); err != nil {
+		if _, err = e.ID(teamUsers[i].UID).Get(member); err != nil {
 			return nil, fmt.Errorf("get user '%d': %v", teamUsers[i].UID, err)
 		}
 		members = append(members, member)
@@ -500,7 +500,7 @@ func AddTeamMember(orgID, teamID, userID int64) error {
 	}
 	if _, err = sess.Insert(tu); err != nil {
 		return err
-	} else if _, err = sess.Id(t.ID).Update(t); err != nil {
+	} else if _, err = sess.ID(t.ID).Update(t); err != nil {
 		return err
 	}
 
@@ -520,7 +520,7 @@ func AddTeamMember(orgID, teamID, userID int64) error {
 	if t.IsOwnerTeam() {
 		ou.IsOwner = true
 	}
-	if _, err = sess.Id(ou.ID).AllCols().Update(ou); err != nil {
+	if _, err = sess.ID(ou.ID).AllCols().Update(ou); err != nil {
 		return err
 	}
 
@@ -562,7 +562,7 @@ func removeTeamMember(e Engine, orgID, teamID, uid int64) error {
 	}
 	if _, err := e.Delete(tu); err != nil {
 		return err
-	} else if _, err = e.Id(t.ID).AllCols().Update(t); err != nil {
+	} else if _, err = e.ID(t.ID).AllCols().Update(t); err != nil {
 		return err
 	}
 
@@ -583,7 +583,7 @@ func removeTeamMember(e Engine, orgID, teamID, uid int64) error {
 	if t.IsOwnerTeam() {
 		ou.IsOwner = false
 	}
-	if _, err = e.Id(ou.ID).AllCols().Update(ou); err != nil {
+	if _, err = e.ID(ou.ID).AllCols().Update(ou); err != nil {
 		return err
 	}
 	return nil

+ 2 - 2
models/pull.go

@@ -321,7 +321,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
 	pr.HasMerged = true
 	pr.Merged = time.Now()
 	pr.MergerID = doer.ID
-	if _, err = sess.Id(pr.ID).AllCols().Update(pr); err != nil {
+	if _, err = sess.ID(pr.ID).AllCols().Update(pr); err != nil {
 		return fmt.Errorf("update pull request: %v", err)
 	}
 
@@ -546,7 +546,7 @@ func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequ
 
 func getPullRequestByID(e Engine, id int64) (*PullRequest, error) {
 	pr := new(PullRequest)
-	has, err := e.Id(id).Get(pr)
+	has, err := e.ID(id).Get(pr)
 	if err != nil {
 		return nil, err
 	} else if !has {

+ 1 - 1
models/release.go

@@ -293,7 +293,7 @@ func UpdateRelease(doer *User, gitRepo *git.Repository, r *Release, isPublish bo
 	if err = sess.Begin(); err != nil {
 		return err
 	}
-	if _, err = sess.Id(r.ID).AllCols().Update(r); err != nil {
+	if _, err = sess.ID(r.ID).AllCols().Update(r); err != nil {
 		return fmt.Errorf("Update: %v", err)
 	}
 

+ 4 - 4
models/repo.go

@@ -1264,7 +1264,7 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
 	repo.Owner = newOwner
 
 	// Update repository.
-	if _, err := sess.Id(repo.ID).Update(repo); err != nil {
+	if _, err := sess.ID(repo.ID).Update(repo); err != nil {
 		return fmt.Errorf("update owner: %v", err)
 	}
 
@@ -1296,7 +1296,7 @@ func TransferOwnership(doer *User, newOwnerName string, repo *Repository) error
 			}
 
 			t.NumRepos--
-			if _, err := sess.Id(t.ID).AllCols().Update(t); err != nil {
+			if _, err := sess.ID(t.ID).AllCols().Update(t); err != nil {
 				return fmt.Errorf("decrease team repository count '%d': %v", t.ID, err)
 			}
 		}
@@ -1409,7 +1409,7 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
 		repo.Website = repo.Website[:255]
 	}
 
-	if _, err = e.Id(repo.ID).AllCols().Update(repo); err != nil {
+	if _, err = e.ID(repo.ID).AllCols().Update(repo); err != nil {
 		return fmt.Errorf("update: %v", err)
 	}
 
@@ -1625,7 +1625,7 @@ func GetRepositoryByName(ownerID int64, name string) (*Repository, error) {
 
 func getRepositoryByID(e Engine, id int64) (*Repository, error) {
 	repo := new(Repository)
-	has, err := e.Id(id).Get(repo)
+	has, err := e.ID(id).Get(repo)
 	if err != nil {
 		return nil, err
 	} else if !has {

+ 2 - 2
models/repo_branch.go

@@ -131,7 +131,7 @@ func UpdateProtectBranch(protectBranch *ProtectBranch) (err error) {
 		}
 	}
 
-	if _, err = sess.Id(protectBranch.ID).AllCols().Update(protectBranch); err != nil {
+	if _, err = sess.ID(protectBranch.ID).AllCols().Update(protectBranch); err != nil {
 		return fmt.Errorf("Update: %v", err)
 	}
 
@@ -234,7 +234,7 @@ func UpdateOrgProtectBranch(repo *Repository, protectBranch *ProtectBranch, whit
 		return err
 	}
 
-	if _, err = sess.Id(protectBranch.ID).AllCols().Update(protectBranch); err != nil {
+	if _, err = sess.ID(protectBranch.ID).AllCols().Update(protectBranch); err != nil {
 		return fmt.Errorf("Update: %v", err)
 	}
 

+ 1 - 1
models/repo_collaboration.go

@@ -170,7 +170,7 @@ func (repo *Repository) ChangeCollaborationAccessMode(userID int64, mode AccessM
 		return err
 	}
 
-	if _, err = sess.Id(collaboration.ID).AllCols().Update(collaboration); err != nil {
+	if _, err = sess.ID(collaboration.ID).AllCols().Update(collaboration); err != nil {
 		return fmt.Errorf("update collaboration: %v", err)
 	}
 

+ 1 - 1
models/ssh_key.go

@@ -747,7 +747,7 @@ func DeleteDeployKey(doer *User, id int64) error {
 		return err
 	}
 
-	if _, err = sess.Id(key.ID).Delete(new(DeployKey)); err != nil {
+	if _, err = sess.ID(key.ID).Delete(new(DeployKey)); err != nil {
 		return fmt.Errorf("delete deploy key [%d]: %v", key.ID, err)
 	}
 

+ 2 - 2
models/user.go

@@ -706,7 +706,7 @@ func updateUser(e Engine, u *User) error {
 	u.Website = tool.TruncateString(u.Website, 255)
 	u.Description = tool.TruncateString(u.Description, 255)
 
-	_, err := e.Id(u.ID).AllCols().Update(u)
+	_, err := e.ID(u.ID).AllCols().Update(u)
 	return err
 }
 
@@ -890,7 +890,7 @@ func GetUserByKeyID(keyID int64) (*User, error) {
 
 func getUserByID(e Engine, id int64) (*User, error) {
 	u := new(User)
-	has, err := e.Id(id).Get(u)
+	has, err := e.ID(id).Get(u)
 	if err != nil {
 		return nil, err
 	} else if !has {

+ 2 - 2
models/user_mail.go

@@ -132,7 +132,7 @@ func (email *EmailAddress) Activate() error {
 	}
 
 	email.IsActivated = true
-	if _, err := sess.Id(email.ID).AllCols().Update(email); err != nil {
+	if _, err := sess.ID(email.ID).AllCols().Update(email); err != nil {
 		return err
 	} else if err = updateUser(sess, user); err != nil {
 		return err
@@ -202,7 +202,7 @@ func MakeEmailPrimary(email *EmailAddress) error {
 	}
 
 	user.Email = email.Email
-	if _, err = sess.Id(user.ID).AllCols().Update(user); err != nil {
+	if _, err = sess.ID(user.ID).AllCols().Update(user); err != nil {
 		return err
 	}