summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-07-21 14:26:30 +0800
committerUnknwon <u@gogs.io>2016-07-21 14:26:30 +0800
commit5761342f3263b909448b515ab7700d1a8ec36ded (patch)
tree1b3f8eaac273a6f72c35f60f1bca11237c712ecd /models/issue.go
parent57af7432fc07f630e435228a306a9deeb3fefa1e (diff)
downloadgitea-5761342f3263b909448b515ab7700d1a8ec36ded.tar.gz
gitea-5761342f3263b909448b515ab7700d1a8ec36ded.zip
#3291 fix SQLite3 session read/update conflict on create new issue
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/models/issue.go b/models/issue.go
index e5335c3b18..189b207df3 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -73,15 +73,19 @@ func (i *Issue) BeforeUpdate() {
i.DeadlineUnix = i.Deadline.UTC().Unix()
}
-func (issue *Issue) loadAttributes() (err error) {
- issue.Repo, err = GetRepositoryByID(issue.RepoID)
+func (issue *Issue) loadAttributes(e Engine) (err error) {
+ issue.Repo, err = getRepositoryByID(e, issue.RepoID)
if err != nil {
- return fmt.Errorf("GetRepositoryByID: %v", err)
+ return fmt.Errorf("getRepositoryByID: %v", err)
}
return nil
}
+func (issue *Issue) LoadAttributes() (err error) {
+ return issue.loadAttributes(x)
+}
+
func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
var err error
switch colName {
@@ -403,7 +407,7 @@ func newIssue(e *xorm.Session, repo *Repository, issue *Issue, labelIDs []int64,
}
}
- return issue.loadAttributes()
+ return issue.loadAttributes(e)
}
// NewIssue creates new issue with labels for repository.
@@ -466,7 +470,7 @@ func GetIssueByRef(ref string) (*Issue, error) {
return nil, err
}
- return issue, issue.loadAttributes()
+ return issue, issue.LoadAttributes()
}
// GetIssueByIndex returns issue by given index in repository.
@@ -481,7 +485,7 @@ func GetIssueByIndex(repoID, index int64) (*Issue, error) {
} else if !has {
return nil, ErrIssueNotExist{0, repoID, index}
}
- return issue, issue.loadAttributes()
+ return issue, issue.LoadAttributes()
}
// GetIssueByID returns an issue by given ID.
@@ -493,7 +497,7 @@ func GetIssueByID(id int64) (*Issue, error) {
} else if !has {
return nil, ErrIssueNotExist{id, 0, 0}
}
- return issue, issue.loadAttributes()
+ return issue, issue.LoadAttributes()
}
type IssuesOptions struct {