mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 09:44:16 +01:00
#3291 fix SQLite3 session read/update conflict on create new issue
This commit is contained in:
parent
57af7432fc
commit
5761342f32
1 changed files with 11 additions and 7 deletions
|
@ -73,15 +73,19 @@ func (i *Issue) BeforeUpdate() {
|
||||||
i.DeadlineUnix = i.Deadline.UTC().Unix()
|
i.DeadlineUnix = i.Deadline.UTC().Unix()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (issue *Issue) loadAttributes() (err error) {
|
func (issue *Issue) loadAttributes(e Engine) (err error) {
|
||||||
issue.Repo, err = GetRepositoryByID(issue.RepoID)
|
issue.Repo, err = getRepositoryByID(e, issue.RepoID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("GetRepositoryByID: %v", err)
|
return fmt.Errorf("getRepositoryByID: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (issue *Issue) LoadAttributes() (err error) {
|
||||||
|
return issue.loadAttributes(x)
|
||||||
|
}
|
||||||
|
|
||||||
func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
|
func (i *Issue) AfterSet(colName string, _ xorm.Cell) {
|
||||||
var err error
|
var err error
|
||||||
switch colName {
|
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.
|
// NewIssue creates new issue with labels for repository.
|
||||||
|
@ -466,7 +470,7 @@ func GetIssueByRef(ref string) (*Issue, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return issue, issue.loadAttributes()
|
return issue, issue.LoadAttributes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssueByIndex returns issue by given index in repository.
|
// GetIssueByIndex returns issue by given index in repository.
|
||||||
|
@ -481,7 +485,7 @@ func GetIssueByIndex(repoID, index int64) (*Issue, error) {
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrIssueNotExist{0, repoID, index}
|
return nil, ErrIssueNotExist{0, repoID, index}
|
||||||
}
|
}
|
||||||
return issue, issue.loadAttributes()
|
return issue, issue.LoadAttributes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssueByID returns an issue by given ID.
|
// GetIssueByID returns an issue by given ID.
|
||||||
|
@ -493,7 +497,7 @@ func GetIssueByID(id int64) (*Issue, error) {
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrIssueNotExist{id, 0, 0}
|
return nil, ErrIssueNotExist{id, 0, 0}
|
||||||
}
|
}
|
||||||
return issue, issue.loadAttributes()
|
return issue, issue.LoadAttributes()
|
||||||
}
|
}
|
||||||
|
|
||||||
type IssuesOptions struct {
|
type IssuesOptions struct {
|
||||||
|
|
Loading…
Reference in a new issue