From 955340a291ecd416192ec3ba8f50582c33fc60c4 Mon Sep 17 00:00:00 2001 From: Thorsten Schubert Date: Sun, 16 Oct 2022 22:07:05 +0000 Subject: [PATCH 1/3] Fix viewing subscriptions --- models/issues/issue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/issues/issue.go b/models/issues/issue.go index 737b625abc160..b97194322c968 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -1492,7 +1492,7 @@ func applySubscribedCondition(sess *xorm.Session, subscriberID int64) *xorm.Sess builder.In("issue.repo_id", builder. Select("id"). From("watch"). - Where(builder.Eq{"user_id": subscriberID, "mode": true}), + Where(builder.Eq{"user_id": subscriberID}.And(builder.Gt{"mode": 0})), ), ), ) From 223a7c7a4d0e547bf451fcb87fea8f02e7d65a7b Mon Sep 17 00:00:00 2001 From: Thorsten Schubert Date: Mon, 17 Oct 2022 23:19:23 +0200 Subject: [PATCH 2/3] Exclude explicit WatchModeDont (2) mode --- models/issues/issue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/issues/issue.go b/models/issues/issue.go index b97194322c968..60a414a52004f 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -1492,7 +1492,7 @@ func applySubscribedCondition(sess *xorm.Session, subscriberID int64) *xorm.Sess builder.In("issue.repo_id", builder. Select("id"). From("watch"). - Where(builder.Eq{"user_id": subscriberID}.And(builder.Gt{"mode": 0})), + Where(builder.Eq{"user_id": subscriberID}.And(builder.In("mode", 1, 3))), ), ), ) From a7f6448f6b1ce889a2925c5b45c1f736535caf5c Mon Sep 17 00:00:00 2001 From: Thorsten Schubert Date: Mon, 17 Oct 2022 22:44:14 +0000 Subject: [PATCH 3/3] Use enum const instead of raw numbers for mode --- models/issues/issue.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/issues/issue.go b/models/issues/issue.go index 60a414a52004f..d9bb476c1d530 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -1492,7 +1492,8 @@ func applySubscribedCondition(sess *xorm.Session, subscriberID int64) *xorm.Sess builder.In("issue.repo_id", builder. Select("id"). From("watch"). - Where(builder.Eq{"user_id": subscriberID}.And(builder.In("mode", 1, 3))), + Where(builder.And(builder.Eq{"user_id": subscriberID}, + builder.In("mode", repo_model.WatchModeNormal, repo_model.WatchModeAuto))), ), ), )