summaryrefslogtreecommitdiffstats
path: root/models/issue_stopwatch.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-12-10 09:27:50 +0800
committerGitHub <noreply@github.com>2021-12-10 09:27:50 +0800
commit719bddcd76610a63dadc8555760072957a11cf30 (patch)
tree0df26092fba7e3e21444fe493e6b349473b6b0cb /models/issue_stopwatch.go
parentfb8166c6c6b652a0e6fa98681780a6a71090faf3 (diff)
downloadgitea-719bddcd76610a63dadc8555760072957a11cf30.tar.gz
gitea-719bddcd76610a63dadc8555760072957a11cf30.zip
Move repository model into models/repo (#17933)
* Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
Diffstat (limited to 'models/issue_stopwatch.go')
-rw-r--r--models/issue_stopwatch.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/models/issue_stopwatch.go b/models/issue_stopwatch.go
index 7754e90a86..530a524218 100644
--- a/models/issue_stopwatch.go
+++ b/models/issue_stopwatch.go
@@ -156,7 +156,7 @@ func FinishIssueStopwatch(ctx context.Context, user *user_model.User, issue *Iss
return err
}
- if err := issue.loadRepo(db.GetEngine(ctx)); err != nil {
+ if err := issue.loadRepo(ctx); err != nil {
return err
}
@@ -177,7 +177,7 @@ func FinishIssueStopwatch(ctx context.Context, user *user_model.User, issue *Iss
// CreateIssueStopwatch creates a stopwatch if not exist, otherwise return an error
func CreateIssueStopwatch(ctx context.Context, user *user_model.User, issue *Issue) error {
e := db.GetEngine(ctx)
- if err := issue.loadRepo(e); err != nil {
+ if err := issue.loadRepo(ctx); err != nil {
return err
}
@@ -207,7 +207,7 @@ func CreateIssueStopwatch(ctx context.Context, user *user_model.User, issue *Iss
return err
}
- if err := issue.loadRepo(db.GetEngine(ctx)); err != nil {
+ if err := issue.loadRepo(ctx); err != nil {
return err
}
@@ -248,11 +248,7 @@ func cancelStopwatch(ctx context.Context, user *user_model.User, issue *Issue) e
return err
}
- if err := issue.loadRepo(e); err != nil {
- return err
- }
-
- if err := issue.loadRepo(db.GetEngine(ctx)); err != nil {
+ if err := issue.loadRepo(ctx); err != nil {
return err
}