aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRami Jasim <minecraftmrgold@gmail.com>2025-05-08 11:53:21 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2025-05-08 13:53:51 +0200
commit95baa5eeb68b0c298ddc005aaa8f1c4e4091d825 (patch)
tree69f150f3eea72e22ee15fdc694e0b0dd06fd4a3a /lib
parent5df23b751ed4e3cdcd99f2c96f074bd2c455317e (diff)
Blubber: countUnseenComments zählt falsch #5597
Closes #5597 Merge request studip/studip!4217
Diffstat (limited to 'lib')
-rw-r--r--lib/models/BlubberThread.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/models/BlubberThread.php b/lib/models/BlubberThread.php
index 371423f..510170e 100644
--- a/lib/models/BlubberThread.php
+++ b/lib/models/BlubberThread.php
@@ -1105,11 +1105,13 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
*/
public function countUnseenComments(string $user_id = null): int
{
+ $user_id = $user_id ?? User::findCurrent();
return \BlubberComment::countBySQL(
- 'thread_id = ? AND mkdate >= ?',
+ 'thread_id = ? AND mkdate >= ? AND user_id != ?',
[
$this->getId(),
- $this->getLastVisit($user_id ?? $GLOBALS['user']->id) ?: object_get_visit_threshold(),
+ $this->getLastVisit($user_id) ?: object_get_visit_threshold(),
+ $user_id
]
);
}