aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue_watch.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-01-07 16:41:35 +0100
committerzeripath <art27@cantab.net>2020-01-07 15:41:35 +0000
commit940636863370855f39688ddf0aae41667ac8935c (patch)
treef042597f15fb5b7d7f15972308a9174e31a43e26 /models/issue_watch.go
parentb6fa229dcfbe4ad64fe758ef92abaf7a80e6f700 (diff)
downloadgitea-940636863370855f39688ddf0aae41667ac8935c.tar.gz
gitea-940636863370855f39688ddf0aae41667ac8935c.zip
Fix Issue Unsubscription (#9634)
Diffstat (limited to 'models/issue_watch.go')
-rw-r--r--models/issue_watch.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/models/issue_watch.go b/models/issue_watch.go
index e42e371a1f..6144d6cafe 100644
--- a/models/issue_watch.go
+++ b/models/issue_watch.go
@@ -4,7 +4,9 @@
package models
-import "code.gitea.io/gitea/modules/timeutil"
+import (
+ "code.gitea.io/gitea/modules/timeutil"
+)
// IssueWatch is connection request for receiving issue notification.
type IssueWatch struct {
@@ -46,17 +48,18 @@ func CreateOrUpdateIssueWatch(userID, issueID int64, isWatching bool) error {
return nil
}
-// GetIssueWatch returns an issue watch by user and issue
+// GetIssueWatch returns all IssueWatch objects from db by user and issue
+// the current Web-UI need iw object for watchers AND explicit non-watchers
func GetIssueWatch(userID, issueID int64) (iw *IssueWatch, exists bool, err error) {
return getIssueWatch(x, userID, issueID)
}
+// Return watcher AND explicit non-watcher if entry in db exist
func getIssueWatch(e Engine, userID, issueID int64) (iw *IssueWatch, exists bool, err error) {
iw = new(IssueWatch)
exists, err = e.
Where("user_id = ?", userID).
And("issue_id = ?", issueID).
- And("is_watching = ?", true).
Get(iw)
return
}