diff options
author | David Schneiderbauer <daviian@users.noreply.github.com> | 2018-06-19 21:44:33 +0200 |
---|---|---|
committer | techknowlogick <techknowlogick@users.noreply.github.com> | 2018-06-19 15:44:33 -0400 |
commit | a93f13849cd7f54029f1dc17b642d024b98ee71e (patch) | |
tree | 99340a1daec2fa3a3db14ed630b57c6bc3984fbe /models/issue_watch.go | |
parent | 467ff4d34302f6ecab959d61bf3944a2bdf125d0 (diff) | |
download | gitea-a93f13849cd7f54029f1dc17b642d024b98ee71e.tar.gz gitea-a93f13849cd7f54029f1dc17b642d024b98ee71e.zip |
Fix not removed watches on unallowed repositories (#4201)
Diffstat (limited to 'models/issue_watch.go')
-rw-r--r-- | models/issue_watch.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/issue_watch.go b/models/issue_watch.go index 69e218af01..3e7d24821b 100644 --- a/models/issue_watch.go +++ b/models/issue_watch.go @@ -71,3 +71,15 @@ func getIssueWatchers(e Engine, issueID int64) (watches []*IssueWatch, err error Find(&watches) return } + +func removeIssueWatchersByRepoID(e Engine, userID int64, repoID int64) error { + iw := &IssueWatch{ + IsWatching: false, + } + _, err := e. + Join("INNER", "issue", "`issue`.id = `issue_watch`.issue_id AND `issue`.repo_id = ?", repoID). + Cols("is_watching", "updated_unix"). + Where("`issue_watch`.user_id = ?", userID). + Update(iw) + return err +} |