From 68697090d4985e6f54259ff724b061e4ceb37b96 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <tleilax+studip@gmail.com> Date: Fri, 16 Sep 2022 09:56:22 +0000 Subject: [PATCH] adjust query for institutes to reflect opting out of blubber notifications, fixes #1587 Closes #1587 Merge request studip/studip!1014 --- lib/models/BlubberThread.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/models/BlubberThread.php b/lib/models/BlubberThread.php index bc721e0f9b9..4fd36395936 100644 --- a/lib/models/BlubberThread.php +++ b/lib/models/BlubberThread.php @@ -722,12 +722,17 @@ class BlubberThread extends SimpleORMap implements PrivacyObject // Institute context: Notify all members of the institute if ($this->context_type === 'institute') { - $query = "SELECT user_id + $query = "SELECT user_inst.user_id FROM user_inst + LEFT JOIN blubber_threads_followstates ON ( + user_inst.user_id = blubber_threads_followstates.user_id + AND blubber_threads_followstates.thread_id = :thread_id + AND blubber_threads_followstates.state = 'unfollowed' + ) WHERE Institut_id = :context_id - AND user_id != :user_id"; + AND user_inst.user_id != :user_id + AND blubber_threads_followstates.user_id IS NULL"; - unset($parameters[':thread_id']); $parameters[':context_id'] = $this->context_id; return compact('query', 'parameters'); -- GitLab