summaryrefslogtreecommitdiffstats
path: root/routers/repo/issue_stopwatch.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-10-16 10:55:43 +0300
committerGitHub <noreply@github.com>2017-10-16 10:55:43 +0300
commitc1b0c9e7c4bbb669ea03694c30c9ff66a109ef17 (patch)
tree06c50be163dfa85264a72b54393eb29aa0f4128c /routers/repo/issue_stopwatch.go
parenta75d5c72bb9d85b2344ee98b4425290423b6e6b2 (diff)
downloadgitea-c1b0c9e7c4bbb669ea03694c30c9ff66a109ef17.tar.gz
gitea-c1b0c9e7c4bbb669ea03694c30c9ff66a109ef17.zip
Fix PR, milestone and label functionality if issue unit is disabled (#2710)
* Fix PR, milestone and label functionality if issue unit is disabled or not assigned to user * Fix multi-actions in PR page * Change error message * Fix comment update and delete functionality in PR
Diffstat (limited to 'routers/repo/issue_stopwatch.go')
-rw-r--r--routers/repo/issue_stopwatch.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/routers/repo/issue_stopwatch.go b/routers/repo/issue_stopwatch.go
index 7e3121da9f..f4392849aa 100644
--- a/routers/repo/issue_stopwatch.go
+++ b/routers/repo/issue_stopwatch.go
@@ -13,11 +13,12 @@ import (
// IssueStopwatch creates or stops a stopwatch for the given issue.
func IssueStopwatch(c *context.Context) {
- issueIndex := c.ParamsInt64("index")
- issue, err := models.GetIssueByIndex(c.Repo.Repository.ID, issueIndex)
-
- if err != nil {
- c.Handle(http.StatusInternalServerError, "GetIssueByIndex", err)
+ issue := GetActionIssue(c)
+ if c.Written() {
+ return
+ }
+ if !c.Repo.CanUseTimetracker(issue, c.User) {
+ c.Handle(http.StatusNotFound, "CanUseTimetracker", nil)
return
}
@@ -32,11 +33,12 @@ func IssueStopwatch(c *context.Context) {
// CancelStopwatch cancel the stopwatch
func CancelStopwatch(c *context.Context) {
- issueIndex := c.ParamsInt64("index")
- issue, err := models.GetIssueByIndex(c.Repo.Repository.ID, issueIndex)
-
- if err != nil {
- c.Handle(http.StatusInternalServerError, "GetIssueByIndex", err)
+ issue := GetActionIssue(c)
+ if c.Written() {
+ return
+ }
+ if !c.Repo.CanUseTimetracker(issue, c.User) {
+ c.Handle(http.StatusNotFound, "CanUseTimetracker", nil)
return
}