summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-08 12:24:11 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-08 12:24:11 -0400
commite86728340654b18a657a65920c16e28a1b00cca7 (patch)
tree5ef13e753aef6fab75c78fac703945fe0938fd03 /routers
parenta03f380fa86f83f35a5636535ec3002100b335bb (diff)
downloadgitea-e86728340654b18a657a65920c16e28a1b00cca7.tar.gz
gitea-e86728340654b18a657a65920c16e28a1b00cca7.zip
Assignee back end
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/issue.go29
-rw-r--r--routers/repo/setting.go2
2 files changed, 23 insertions, 8 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index da34c03c25..3d25f06ae5 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -114,6 +114,13 @@ func CreateIssue(ctx *middleware.Context, params martini.Params) {
ctx.Data["Title"] = "Create issue"
ctx.Data["IsRepoToolbarIssues"] = true
ctx.Data["IsRepoToolbarIssuesList"] = false
+
+ us, err := models.GetCollaborators(strings.TrimPrefix(ctx.Repo.RepoLink, "/"))
+ if err != nil {
+ ctx.Handle(500, "issue.CreateIssue(GetCollaborators)", err)
+ return
+ }
+ ctx.Data["Collaborators"] = us
ctx.HTML(200, "issue/create")
}
@@ -122,6 +129,13 @@ func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.C
ctx.Data["IsRepoToolbarIssues"] = true
ctx.Data["IsRepoToolbarIssuesList"] = false
+ us, err := models.GetCollaborators(strings.TrimPrefix(ctx.Repo.RepoLink, "/"))
+ if err != nil {
+ ctx.Handle(500, "issue.CreateIssue(GetCollaborators)", err)
+ return
+ }
+ ctx.Data["Collaborators"] = us
+
if ctx.HasError() {
ctx.HTML(200, "issue/create")
return
@@ -140,8 +154,8 @@ func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.C
if err := models.NewIssue(issue); err != nil {
ctx.Handle(500, "issue.CreateIssue(NewIssue)", err)
return
- } else if err := models.NewIssueUserPairs(issue.RepoId, issue.Id,
- ctx.Repo.Owner.Id, ctx.User.Id, form.AssigneeId); err != nil {
+ } else if err := models.NewIssueUserPairs(issue.RepoId, issue.Id, ctx.Repo.Owner.Id,
+ ctx.User.Id, form.AssigneeId, ctx.Repo.Repository.Name); err != nil {
ctx.Handle(500, "issue.CreateIssue(NewIssueUserPairs)", err)
return
}
@@ -219,13 +233,14 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) {
return
}
- // Get poster.
- u, err := models.GetUserById(issue.PosterId)
- if err != nil {
- ctx.Handle(500, "issue.ViewIssue(GetUserById): %v", err)
+ // Get poster and Assignee.
+ if err = issue.GetPoster(); err != nil {
+ ctx.Handle(500, "issue.ViewIssue(GetPoster): %v", err)
+ return
+ } else if err = issue.GetAssignee(); err != nil {
+ ctx.Handle(500, "issue.ViewIssue(GetAssignee): %v", err)
return
}
- issue.Poster = u
issue.RenderedContent = string(base.RenderMarkdown([]byte(issue.Content), ctx.Repo.RepoLink))
// Get comments.
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 96f9f857f1..d7c273c63a 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -136,7 +136,7 @@ func Collaboration(ctx *middleware.Context) {
return
}
- names, err := models.GetCollaborators(repoLink)
+ names, err := models.GetCollaboratorNames(repoLink)
if err != nil {
ctx.Handle(500, "setting.Collaboration(GetCollaborators)", err)
return