summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-21 17:11:48 +0800
committerGitHub <noreply@github.com>2021-11-21 17:11:48 +0800
commit0add627182388ac63fd04b94cdf912fb87fd0326 (patch)
tree17144fd985993ef4739874b3c304d0a10f8ee84f /routers/api/v1/repo
parentab09296d374aedd1eec813ca007810a76e6625e9 (diff)
downloadgitea-0add627182388ac63fd04b94cdf912fb87fd0326.tar.gz
gitea-0add627182388ac63fd04b94cdf912fb87fd0326.zip
Fix close issue but time watcher still running (#17643)
* Fix close issue but time watcher still running * refactor stopwatch codes * Fix test * Fix test * Fix typo * Fix test
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r--routers/api/v1/repo/issue_stopwatch.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/api/v1/repo/issue_stopwatch.go b/routers/api/v1/repo/issue_stopwatch.go
index 82a9ffe10b..ce80182511 100644
--- a/routers/api/v1/repo/issue_stopwatch.go
+++ b/routers/api/v1/repo/issue_stopwatch.go
@@ -9,6 +9,7 @@ import (
"net/http"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/routers/api/v1/utils"
@@ -55,7 +56,7 @@ func StartIssueStopwatch(ctx *context.APIContext) {
return
}
- if err := models.CreateOrStopIssueStopwatch(ctx.User, issue); err != nil {
+ if err := models.CreateIssueStopwatch(db.DefaultContext, ctx.User, issue); err != nil {
ctx.Error(http.StatusInternalServerError, "CreateOrStopIssueStopwatch", err)
return
}
@@ -104,7 +105,7 @@ func StopIssueStopwatch(ctx *context.APIContext) {
return
}
- if err := models.CreateOrStopIssueStopwatch(ctx.User, issue); err != nil {
+ if err := models.FinishIssueStopwatch(db.DefaultContext, ctx.User, issue); err != nil {
ctx.Error(http.StatusInternalServerError, "CreateOrStopIssueStopwatch", err)
return
}