summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-07-24 21:02:49 +0800
committerUnknwon <u@gogs.io>2015-07-24 21:02:49 +0800
commitac95f6d50f674cae1a5ae3889fdf3c56eb7c005d (patch)
tree274c1e8087aca7b0a366eaf61b08fbd177a52a29 /models
parent86dbda0b42d05caf11d5c6d040f18dfbcc742e04 (diff)
downloadgitea-ac95f6d50f674cae1a5ae3889fdf3c56eb7c005d.tar.gz
gitea-ac95f6d50f674cae1a5ae3889fdf3c56eb7c005d.zip
UI: basic label list
- create new label
Diffstat (limited to 'models')
-rw-r--r--models/action.go10
-rw-r--r--models/issue.go24
-rw-r--r--models/repo.go2
3 files changed, 18 insertions, 18 deletions
diff --git a/models/action.go b/models/action.go
index d3393728fb..86520b57b1 100644
--- a/models/action.go
+++ b/models/action.go
@@ -153,7 +153,7 @@ func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, com
url := fmt.Sprintf("%s/%s/%s/commit/%s", setting.AppSubUrl, repoUserName, repoName, c.Sha1)
message := fmt.Sprintf(`<a href="%s">%s</a>`, url, c.Message)
- if _, err = CreateComment(userId, issue.RepoId, issue.Id, 0, 0, COMMENT_TYPE_COMMIT, message, nil); err != nil {
+ if _, err = CreateComment(userId, issue.RepoId, issue.ID, 0, 0, COMMENT_TYPE_COMMIT, message, nil); err != nil {
return err
}
}
@@ -202,7 +202,7 @@ func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, com
if err = UpdateIssue(issue); err != nil {
return err
- } else if err = UpdateIssueUserPairsByStatus(issue.Id, issue.IsClosed); err != nil {
+ } else if err = UpdateIssueUserPairsByStatus(issue.ID, issue.IsClosed); err != nil {
return err
}
@@ -211,7 +211,7 @@ func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, com
}
// If commit happened in the referenced repository, it means the issue can be closed.
- if _, err = CreateComment(userId, repoId, issue.Id, 0, 0, COMMENT_TYPE_CLOSE, "", nil); err != nil {
+ if _, err = CreateComment(userId, repoId, issue.ID, 0, 0, COMMENT_TYPE_CLOSE, "", nil); err != nil {
return err
}
}
@@ -261,7 +261,7 @@ func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, com
if err = UpdateIssue(issue); err != nil {
return err
- } else if err = UpdateIssueUserPairsByStatus(issue.Id, issue.IsClosed); err != nil {
+ } else if err = UpdateIssueUserPairsByStatus(issue.ID, issue.IsClosed); err != nil {
return err
}
@@ -270,7 +270,7 @@ func updateIssuesCommit(userId, repoId int64, repoUserName, repoName string, com
}
// If commit happened in the referenced repository, it means the issue can be closed.
- if _, err = CreateComment(userId, repoId, issue.Id, 0, 0, COMMENT_TYPE_REOPEN, "", nil); err != nil {
+ if _, err = CreateComment(userId, repoId, issue.ID, 0, 0, COMMENT_TYPE_REOPEN, "", nil); err != nil {
return err
}
}
diff --git a/models/issue.go b/models/issue.go
index 96bffa0b60..4ddf5725f9 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -32,7 +32,7 @@ var (
// Issue represents an issue or pull request of repository.
type Issue struct {
- Id int64
+ ID int64 `xorm:"pk autoincr"`
RepoId int64 `xorm:"INDEX"`
Index int64 // Index in one repository.
Name string
@@ -100,15 +100,15 @@ func (i *Issue) GetAssignee() (err error) {
}
func (i *Issue) Attachments() []*Attachment {
- a, _ := GetAttachmentsForIssue(i.Id)
+ a, _ := GetAttachmentsForIssue(i.ID)
return a
}
func (i *Issue) AfterDelete() {
- _, err := DeleteAttachmentsByIssue(i.Id, true)
+ _, err := DeleteAttachmentsByIssue(i.ID, true)
if err != nil {
- log.Info("Could not delete files for issue #%d: %s", i.Id, err)
+ log.Info("Could not delete files for issue #%d: %s", i.ID, err)
}
}
@@ -175,7 +175,7 @@ func GetIssueByIndex(rid, index int64) (*Issue, error) {
// GetIssueById returns an issue by ID.
func GetIssueById(id int64) (*Issue, error) {
- issue := &Issue{Id: id}
+ issue := &Issue{ID: id}
has, err := x.Get(issue)
if err != nil {
return nil, err
@@ -456,7 +456,7 @@ func GetUserIssueStats(uid int64, filterMode int) *IssueStats {
// UpdateIssue updates information of issue.
func UpdateIssue(issue *Issue) error {
- _, err := x.Id(issue.Id).AllCols().Update(issue)
+ _, err := x.Id(issue.ID).AllCols().Update(issue)
if err != nil {
return err
@@ -526,7 +526,7 @@ func UpdateIssueUserPairsByMentions(uids []int64, iid int64) error {
// Label represents a label of repository for issues.
type Label struct {
- Id int64
+ ID int64 `xorm:"pk autoincr"`
RepoId int64 `xorm:"INDEX"`
Name string
Color string `xorm:"VARCHAR(7)"`
@@ -553,7 +553,7 @@ func GetLabelById(id int64) (*Label, error) {
return nil, ErrLabelNotExist
}
- l := &Label{Id: id}
+ l := &Label{ID: id}
has, err := x.Get(l)
if err != nil {
return nil, err
@@ -572,7 +572,7 @@ func GetLabels(repoId int64) ([]*Label, error) {
// UpdateLabel updates label information.
func UpdateLabel(l *Label) error {
- _, err := x.Id(l.Id).AllCols().Update(l)
+ _, err := x.Id(l.ID).AllCols().Update(l)
return err
}
@@ -600,7 +600,7 @@ func DeleteLabel(repoId int64, strId string) error {
for _, issue := range issues {
issue.LabelIds = strings.Replace(issue.LabelIds, "$"+strId+"|", "", -1)
- if _, err = sess.Id(issue.Id).AllCols().Update(issue); err != nil {
+ if _, err = sess.Id(issue.ID).AllCols().Update(issue); err != nil {
sess.Rollback()
return err
}
@@ -788,7 +788,7 @@ func ChangeMilestoneAssign(oldMid, mid int64, issue *Issue) (err error) {
}
rawSql := "UPDATE `issue_user` SET milestone_id = 0 WHERE issue_id = ?"
- if _, err = sess.Exec(rawSql, issue.Id); err != nil {
+ if _, err = sess.Exec(rawSql, issue.ID); err != nil {
sess.Rollback()
return err
}
@@ -816,7 +816,7 @@ func ChangeMilestoneAssign(oldMid, mid int64, issue *Issue) (err error) {
}
rawSql := "UPDATE `issue_user` SET milestone_id = ? WHERE issue_id = ?"
- if _, err = sess.Exec(rawSql, m.Id, issue.Id); err != nil {
+ if _, err = sess.Exec(rawSql, m.Id, issue.ID); err != nil {
sess.Rollback()
return err
}
diff --git a/models/repo.go b/models/repo.go
index 4ee5c382fb..5610776a9f 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -876,7 +876,7 @@ func DeleteRepository(uid, repoID int64, userName string) error {
return err
}
for i := range issues {
- if _, err = sess.Delete(&Comment{IssueId: issues[i].Id}); err != nil {
+ if _, err = sess.Delete(&Comment{IssueId: issues[i].ID}); err != nil {
return err
}
}