Skip to content

Commit 8aaba65

Browse files
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 <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 5283d1e commit 8aaba65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/issue_stopwatch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type UserStopwatch struct {
7575
// GetUIDsAndNotificationCounts between the two provided times
7676
func GetUIDsAndStopwatch() ([]*UserStopwatch, error) {
7777
sws := []*Stopwatch{}
78-
if err := db.GetEngine(db.DefaultContext).Find(&sws); err != nil {
78+
if err := db.GetEngine(db.DefaultContext).Where("issue_id != 0").Find(&sws); err != nil {
7979
return nil, err
8080
}
8181
if len(sws) == 0 {

0 commit comments

Comments
 (0)