1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Add watch button on issue

This commit is contained in:
Andrey Nering
2017-03-29 20:31:47 -03:00
parent a0d0de7233
commit b674460748
6 changed files with 111 additions and 0 deletions

View File

@@ -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))