summaryrefslogtreecommitdiffstats
path: root/models/issue.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2015-02-11 21:58:37 -0500
committerUnknwon <joe2010xtmf@163.com>2015-02-11 21:58:37 -0500
commit7e7160eefd6524013003d1c9668db4d358df5251 (patch)
tree4ca5963cfb5c0dbe8e806942cdf8d6997580a6f0 /models/issue.go
parentc5c467a9cd805c7cd0fb93f467e0205ee082cca3 (diff)
downloadgitea-7e7160eefd6524013003d1c9668db4d358df5251.tar.gz
gitea-7e7160eefd6524013003d1c9668db4d358df5251.zip
first pass work on migration #925
Diffstat (limited to 'models/issue.go')
-rw-r--r--models/issue.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/models/issue.go b/models/issue.go
index 9e1d52260f..3cd71d8aa4 100644
--- a/models/issue.go
+++ b/models/issue.go
@@ -282,30 +282,33 @@ type IssueUser struct {
}
// NewIssueUserPairs adds new issue-user pairs for new issue of repository.
-func NewIssueUserPairs(repo *Repository, iid, oid, pid, aid int64) (err error) {
- iu := &IssueUser{IssueId: iid, RepoId: repo.Id}
-
- us, err := repo.GetCollaborators()
+func NewIssueUserPairs(repo *Repository, issueID, orgID, posterID, assigneeID int64) (err error) {
+ users, err := repo.GetCollaborators()
if err != nil {
return err
}
+ iu := &IssueUser{
+ IssueId: issueID,
+ RepoId: repo.Id,
+ }
+
isNeedAddPoster := true
- for _, u := range us {
+ for _, u := range users {
iu.Uid = u.Id
- iu.IsPoster = iu.Uid == pid
+ iu.IsPoster = iu.Uid == posterID
if isNeedAddPoster && iu.IsPoster {
isNeedAddPoster = false
}
- iu.IsAssigned = iu.Uid == aid
+ iu.IsAssigned = iu.Uid == assigneeID
if _, err = x.Insert(iu); err != nil {
return err
}
}
if isNeedAddPoster {
- iu.Uid = pid
+ iu.Uid = posterID
iu.IsPoster = true
- iu.IsAssigned = iu.Uid == aid
+ iu.IsAssigned = iu.Uid == assigneeID
if _, err = x.Insert(iu); err != nil {
return err
}