|
|
@ -37,12 +37,7 @@ type Issue struct { |
|
|
|
} |
|
|
|
|
|
|
|
// CreateIssue creates new issue for repository.
|
|
|
|
func CreateIssue(userId, repoId, milestoneId, assigneeId int64, issueCount int, name, labels, content string, isPull bool) (*Issue, error) { |
|
|
|
count, err := GetIssueCount(repoId) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
|
|
|
|
func CreateIssue(userId, repoId, milestoneId, assigneeId int64, issueCount int, name, labels, content string, isPull bool) (issue *Issue, err error) { |
|
|
|
// TODO: find out mentions
|
|
|
|
mentions := "" |
|
|
|
|
|
|
@ -50,8 +45,8 @@ func CreateIssue(userId, repoId, milestoneId, assigneeId int64, issueCount int, |
|
|
|
defer sess.Close() |
|
|
|
sess.Begin() |
|
|
|
|
|
|
|
issue := &Issue{ |
|
|
|
Index: count + 1, |
|
|
|
issue = &Issue{ |
|
|
|
Index: int64(issueCount) + 1, |
|
|
|
Name: name, |
|
|
|
RepoId: repoId, |
|
|
|
PosterId: userId, |
|
|
@ -81,11 +76,6 @@ func CreateIssue(userId, repoId, milestoneId, assigneeId int64, issueCount int, |
|
|
|
return issue, nil |
|
|
|
} |
|
|
|
|
|
|
|
// GetIssueCount returns count of issues in the repository.
|
|
|
|
func GetIssueCount(repoId int64) (int64, error) { |
|
|
|
return orm.Count(&Issue{RepoId: repoId}) |
|
|
|
} |
|
|
|
|
|
|
|
// GetIssueById returns issue object by given id.
|
|
|
|
func GetIssueByIndex(repoId, index int64) (*Issue, error) { |
|
|
|
issue := &Issue{RepoId: repoId, Index: index} |
|
|
@ -148,16 +138,10 @@ func GetIssues(userId, repoId, posterId, milestoneId int64, page int, isClosed, |
|
|
|
|
|
|
|
// UpdateIssue updates information of issue.
|
|
|
|
func UpdateIssue(issue *Issue) error { |
|
|
|
_, err := orm.Update(issue, &Issue{RepoId: issue.RepoId, Index: issue.Index}) |
|
|
|
_, err := orm.Id(issue.Id).AllCols().Update(issue) |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
func CloseIssue() { |
|
|
|
} |
|
|
|
|
|
|
|
func ReopenIssue() { |
|
|
|
} |
|
|
|
|
|
|
|
// Label represents a list of labels of repository for issues.
|
|
|
|
type Label struct { |
|
|
|
Id int64 |
|
|
@ -197,8 +181,7 @@ func CreateComment(userId, issueId, commitId, line int64, content string) error |
|
|
|
sess.Begin() |
|
|
|
|
|
|
|
if _, err := orm.Insert(&Comment{PosterId: userId, IssueId: issueId, |
|
|
|
CommitId: commitId, Line: line, Content: content, |
|
|
|
}); err != nil { |
|
|
|
CommitId: commitId, Line: line, Content: content}); err != nil { |
|
|
|
sess.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|