Skip to content
Snippets Groups Projects
Commit 7c850462 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

fixes #3819

Closes #3819

Merge request studip/studip!2692
parent 6803776e
No related branches found
No related tags found
No related merge requests found
...@@ -180,14 +180,14 @@ class BlubberThread extends SimpleORMap implements PrivacyObject ...@@ -180,14 +180,14 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
$query = SQLQuery::table('blubber_threads') $query = SQLQuery::table('blubber_threads');
->join('my_comments', 'blubber_comments', 'blubber_threads.thread_id = my_comments.thread_id', 'LEFT JOIN') $query->join('my_comments', 'blubber_comments', 'blubber_threads.thread_id = my_comments.thread_id AND my_comments.user_id = :user_id', 'LEFT JOIN');
->join('blubber_mentions', 'blubber_mentions', 'blubber_mentions.thread_id = blubber_threads.thread_id', 'LEFT JOIN'); $query->join('blubber_mentions', 'blubber_mentions', 'blubber_mentions.thread_id = blubber_threads.thread_id', 'LEFT JOIN');
if (!$GLOBALS['perm']->have_perm('admin', $user_id)) { if (!$GLOBALS['perm']->have_perm('admin', $user_id)) {
//user, autor, tutor, dozent //user, autor, tutor, dozent
$query->where('mycourses', implode(' OR ', [ $query->where('mycourses', implode(' OR ', [
"(blubber_threads.context_type = 'public' AND (my_comments.user_id = :user_id OR blubber_threads.user_id = :user_id OR blubber_threads.thread_id = 'global'))", "(blubber_threads.context_type = 'public' AND (my_comments.comment_id IS NOT NULL OR blubber_threads.user_id = :user_id OR blubber_threads.thread_id = 'global'))",
"(blubber_threads.context_type = 'course' AND blubber_threads.context_id IN (:seminar_ids))", "(blubber_threads.context_type = 'course' AND blubber_threads.context_id IN (:seminar_ids))",
"(blubber_threads.context_type = 'institute' AND blubber_threads.context_id IN (:institut_ids))", "(blubber_threads.context_type = 'institute' AND blubber_threads.context_id IN (:institut_ids))",
"(blubber_threads.context_type = 'private' AND blubber_mentions.user_id = :user_id AND blubber_mentions.external_contact = 0)", "(blubber_threads.context_type = 'private' AND blubber_mentions.user_id = :user_id AND blubber_mentions.external_contact = 0)",
...@@ -198,14 +198,14 @@ class BlubberThread extends SimpleORMap implements PrivacyObject ...@@ -198,14 +198,14 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
} elseif (!$GLOBALS['perm']->have_perm('root', $user_id)) { } elseif (!$GLOBALS['perm']->have_perm('root', $user_id)) {
//admin //admin
$query->where('mycourses', implode(' OR ', [ $query->where('mycourses', implode(' OR ', [
"(blubber_threads.context_type = 'public' AND (my_comments.user_id = :user_id OR blubber_threads.user_id = :user_id OR blubber_threads.thread_id = 'global'))", "(blubber_threads.context_type = 'public' AND (my_comments.comment_id IS NOT NULL OR blubber_threads.user_id = :user_id OR blubber_threads.thread_id = 'global'))",
"(blubber_threads.context_type = 'institute' AND blubber_threads.context_id IN (:institut_ids))", "(blubber_threads.context_type = 'institute' AND blubber_threads.context_id IN (:institut_ids))",
"(blubber_threads.context_type = 'private' AND blubber_mentions.user_id = :user_id AND blubber_mentions.external_contact = 0)", "(blubber_threads.context_type = 'private' AND blubber_mentions.user_id = :user_id AND blubber_mentions.external_contact = 0)",
]), ['institut_ids' => self::getMyBlubberInstitutes($user_id)]); ]), ['institut_ids' => self::getMyBlubberInstitutes($user_id)]);
} else { } else {
//root //root
$query->where(implode(' OR ', [ $query->where(implode(' OR ', [
"((blubber_threads.context_type = 'public' OR blubber_threads.context_type IN ('course', 'institute')) AND (my_comments.user_id = :user_id OR blubber_threads.user_id = :user_id OR blubber_threads.thread_id = 'global'))", "(blubber_threads.context_type IN ('public', 'course', 'institute') AND (my_comments.comment_id IS NOT NULL OR blubber_threads.user_id = :user_id OR blubber_threads.thread_id = 'global'))",
"(blubber_threads.context_type = 'private' AND blubber_mentions.user_id = :user_id AND blubber_mentions.external_contact = '0')", "(blubber_threads.context_type = 'private' AND blubber_mentions.user_id = :user_id AND blubber_mentions.external_contact = '0')",
])); ]));
} }
...@@ -217,17 +217,6 @@ class BlubberThread extends SimpleORMap implements PrivacyObject ...@@ -217,17 +217,6 @@ class BlubberThread extends SimpleORMap implements PrivacyObject
$threads = []; $threads = [];
foreach ($threads as $thread) {
if ($since) {
$active_time = $thread->getLatestActivity();
$since = max($since, $active_time);
}
if ($olderthan) {
$active_time = $thread->getLatestActivity();
$olderthan = min($olderthan, $active_time);
}
}
do { do {
list($newthreads, $filtered, $new_since, $new_olderthan) = self::getOrderedThreads( list($newthreads, $filtered, $new_since, $new_olderthan) = self::getOrderedThreads(
$thread_ids, $thread_ids,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment