From 53b6639939c9e5de034284655bdc50782dbc80f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Sch=C3=BCttl=C3=B6ffel?= Date: Tue, 4 Mar 2025 07:51:32 +0000 Subject: =?UTF-8?q?Resolve=20"Timeout=20bei=20gro=C3=9Fen=20Blubber=20Thre?= =?UTF-8?q?ads"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #5313 Merge request studip/studip!4001 --- .../5.3.29_add_index_blubber_comments_mkdate.php | 20 ++++++++++++++ lib/models/BlubberThread.php | 31 ++-------------------- templates/blubber/course_context.php | 20 -------------- 3 files changed, 22 insertions(+), 49 deletions(-) create mode 100644 db/migrations/5.3.29_add_index_blubber_comments_mkdate.php diff --git a/db/migrations/5.3.29_add_index_blubber_comments_mkdate.php b/db/migrations/5.3.29_add_index_blubber_comments_mkdate.php new file mode 100644 index 0000000..1d7ed7a --- /dev/null +++ b/db/migrations/5.3.29_add_index_blubber_comments_mkdate.php @@ -0,0 +1,20 @@ +exec("ALTER TABLE `blubber_comments` ADD INDEX mkdate (`mkdate`)"); + } + + public function down() + { + DBManager::get()->exec("ALTER TABLE `blubber_comments` DROP INDEX (`mkdate`)"); + } +} diff --git a/lib/models/BlubberThread.php b/lib/models/BlubberThread.php index 4c3b585..17b3c95 100644 --- a/lib/models/BlubberThread.php +++ b/lib/models/BlubberThread.php @@ -464,41 +464,14 @@ class BlubberThread extends SimpleORMap implements PrivacyObject public function getContextTemplate() { if ($this['context_type'] === 'course') { - $course = Course::find($this['context_id']); - $icons = []; - $schedule_active = false; - foreach ($course->tools as $tool) { - if ($module = $tool->getStudipModule()) { - $last_visit = object_get_visit($this['context_id'], $module->getPluginId()); - $nav = $module->getIconNavigation($this['context_id'], $last_visit, $GLOBALS['user']->id); - if ( - isset($nav) - && $nav->isVisible(true) - && $module->getTabNavigation($this['context_id']) - && $GLOBALS['perm']->have_studip_perm($tool->getVisibilityPermission(), $this['context_id']) - ) { - $icons[] = $nav; - } - if ($module instanceof CoreSchedule) { - $schedule_active = true; - } - } - } - - $nextdate = false; - if ($schedule_active) { - $nextdate = CourseDate::findOneBySQL("range_id = ? AND `date` >= UNIX_TIMESTAMP() ORDER BY `date` ASC", [$this['context_id']]); - } - $teachers = CourseMember::findBySQL("Seminar_id = ? AND status = 'dozent' ORDER BY position ASC", [$this['context_id']]); $tutors = CourseMember::findBySQL("Seminar_id = ? AND status = 'tutor' ORDER BY position ASC", [$this['context_id']]); $students_count = CourseMember::countBySQL("Seminar_id = ? AND status IN ('autor', 'user') ORDER BY position ASC", [$this['context_id']]); $template = $GLOBALS['template_factory']->open('blubber/course_context'); $template->thread = $this; - $template->course = $course; - $template->icons = $icons; - $template->nextdate = $nextdate; + $template->course = Course::find($this['context_id']); + $template->teachers = $teachers; $template->tutors = $tutors; $template->students_count = $students_count; diff --git a/templates/blubber/course_context.php b/templates/blubber/course_context.php index 0d6d2af..583a959 100644 --- a/templates/blubber/course_context.php +++ b/templates/blubber/course_context.php @@ -4,28 +4,8 @@ $course->getId()]) ?>"> name) ?> -
- -
- -
-

- getId(), ['cid' => $course->id]) ?>" data-dialog="size=auto"> - asImg(Icon::SIZE_INLINE, ['class' => 'text-bottom']) ?> - getFullName()) ?> - -
-
getSemClass() ?>

-- cgit v1.0