summaryrefslogtreecommitdiffstats
path: root/routers/repo/issue.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r--routers/repo/issue.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 0a723d755b..61f79a239c 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -465,6 +465,20 @@ func ViewIssue(ctx *context.Context) {
}
ctx.Data["Title"] = fmt.Sprintf("#%d - %s", issue.Index, issue.Title)
+ iw, exists, err := models.GetIssueWatch(ctx.User.ID, issue.ID)
+ if err != nil {
+ ctx.Handle(500, "GetIssueWatch", err)
+ return
+ }
+ if !exists {
+ iw = &models.IssueWatch{
+ UserID: ctx.User.ID,
+ IssueID: issue.ID,
+ IsWatching: models.IsWatching(ctx.User.ID, ctx.Repo.Repository.ID),
+ }
+ }
+ ctx.Data["IssueWatch"] = iw
+
// Make sure type and URL matches.
if ctx.Params(":type") == "issues" && issue.IsPull {
ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(issue.Index))