@@ -100,25 +100,20 @@ func GetIssueWatchersIDs(ctx context.Context, issueID int64, watching bool) ([]i
100
100
101
101
// GetIssueWatchers returns watchers/unwatchers of a given issue
102
102
func GetIssueWatchers (ctx context.Context , issueID int64 , listOptions db.ListOptions ) ([]int64 , error ) {
103
- subscribeWatchers := builder .Select ("`issue_watch`.user_id" ).
104
- From ("issue_watch" ).
105
- Where (builder.Eq {"`issue_watch`.issue_id" : issueID }).
106
- And (builder.Eq {"`issue_watch`.is_watching" : true })
107
-
108
- participantsWatchers := builder .Select ("`comment`.poster_id" ).
109
- From ("comment" ).
110
- Where (builder.Eq {"`comment`.issue_id" : issueID }).
111
- And (builder .In ("`comment`.type" , CommentTypeComment , CommentTypeCode , CommentTypeReview )).
112
- And (builder .NotIn ("`comment`.poster_id" ,
113
- builder .Select ("`issue_watch`.user_id" ).
114
- From ("issue_watch" ).
115
- Where (builder.Eq {"`issue_watch`.issue_id" : issueID }).
116
- And (builder.Eq {"`issue_watch`.is_watching" : false })))
117
-
118
- sess := db .GetEngine (ctx ).Select ("id" ).Table ("user" ).
119
- Where (builder .Or (builder .In ("id" , participantsWatchers ), builder .In ("id" , subscribeWatchers ))).
120
- And (builder.Eq {"`user`.is_active" : true }).
121
- And (builder.Eq {"`user`.prohibit_login" : false })
103
+ issueWatchers := builder .Select ("`issue_watch`.user_id" ).From ("issue_watch" ).
104
+ Where (builder.Eq {"`issue_watch`.issue_id" : issueID })
105
+
106
+ participantsWatchers := builder .Select ("`comment`.poster_id" ).From ("comment" ).
107
+ Where (builder .And (
108
+ builder.Eq {"`comment`.issue_id" : issueID }),
109
+ builder .In ("`comment`.type" , CommentTypeComment , CommentTypeCode , CommentTypeReview ),
110
+ builder .NotIn ("`comment`.poster_id" , issueWatchers .And (builder.Eq {"`issue_watch`.is_watching" : false }),
111
+ )
112
+
113
+ sess := db .GetEngine (ctx ).Select ("`user`.id" ).Table ("user" ).
114
+ Where (builder .And (
115
+ builder .Or (builder .In ("`user`.id" , participantsWatchers ), builder .In ("`user`.id" , issueWatchers .And (builder.Eq {"`issue_watch`.is_watching" : true })))),
116
+ builder.Eq {"`user`.is_active" : true , "`user`.prohibit_login" : false })
122
117
123
118
if listOptions .Page != 0 {
124
119
sess = db .SetSessionPagination (sess , & listOptions )
0 commit comments