@@ -140,11 +140,7 @@ listEmailDeliveryMethods userId maySubscriptionId = do
140140 FROM notification_emails ne
141141 WHERE ne.subscriber_user_id = #{userId}
142142 AND (#{maySubscriptionId} IS NULL
143- OR EXISTS(
144- SELECT FROM notification_by_email nbe
145- WHERE nbe.subscription_id = #{maySubscriptionId}
146- AND nbe.email_id = ne.id
147- )
143+ OR ne.subscription_id = #{maySubscriptionId}
148144 )
149145 ORDER BY ne.email
150146 |]
@@ -157,11 +153,7 @@ listWebhooks userId maySubscriptionId = do
157153 FROM notification_webhooks nw
158154 WHERE nw.subscriber_user_id = #{userId}
159155 AND (#{maySubscriptionId} IS NULL
160- OR EXISTS(
161- SELECT FROM notification_by_webhook nbw
162- WHERE nbw.subscription_id = #{maySubscriptionId}
163- AND nbw.webhook_id = nw.id
164- )
156+ OR nw.subscription_id = #{maySubscriptionId}
165157 )
166158 ORDER BY nw.created_at
167159 |]
@@ -551,8 +543,7 @@ listProjectWebhooks projectId = do
551543 ns.created_at,
552544 ns.updated_at
553545 FROM notification_subscriptions ns
554- JOIN notification_by_webhook nbw ON ns.id = nbw.subscription_id
555- JOIN notification_webhooks nw ON nbw.webhook_id = nw.id
546+ JOIN notification_webhooks nw ON nw.subscription_id = ns.id
556547 WHERE ns.subscriber_project_id = #{projectId}
557548 |]
558549 <&> fmap (\ ((webhookId, webhookName) PG. :. subscription) -> (webhookId, webhookName, subscription))
0 commit comments