summaryrefslogtreecommitdiffstats
path: root/models/issue_stopwatch.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-06-02 03:36:46 +0100
committerGitHub <noreply@github.com>2022-06-02 10:36:46 +0800
commit8aaba65eeeb7b312a312919c7ccd513acc301f6d (patch)
treef34b7abec490f6aa6a48ae084246671dffeda6ec /models/issue_stopwatch.go
parent5283d1ead585429a1c50ae6f332979d74f9b3b60 (diff)
downloadgitea-8aaba65eeeb7b312a312919c7ccd513acc301f6d.tar.gz
gitea-8aaba65eeeb7b312a312919c7ccd513acc301f6d.zip
Only return valid stopwatches (#19863)
Looking through the logs of try.gitea.io I am seeing a number of reports of being unable to APIformat stopwatches because the issueID is 0. These are invalid StopWatches and they represent a db inconsistency. This PR simply stops sending them to the eventsource. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/issue_stopwatch.go')
-rw-r--r--models/issue_stopwatch.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/issue_stopwatch.go b/models/issue_stopwatch.go
index 5b9f5c402d..2cb4a62bd3 100644
--- a/models/issue_stopwatch.go
+++ b/models/issue_stopwatch.go
@@ -75,7 +75,7 @@ type UserStopwatch struct {
// GetUIDsAndNotificationCounts between the two provided times
func GetUIDsAndStopwatch() ([]*UserStopwatch, error) {
sws := []*Stopwatch{}
- if err := db.GetEngine(db.DefaultContext).Find(&sws); err != nil {
+ if err := db.GetEngine(db.DefaultContext).Where("issue_id != 0").Find(&sws); err != nil {
return nil, err
}
if len(sws) == 0 {