From 82afe03977f46832940b208e294c8a8dbe4136ca Mon Sep 17 00:00:00 2001 From: "jorg.vr" Date: Mon, 9 Dec 2024 11:07:13 +0100 Subject: [PATCH] Allow zeus to see activities in hidden courses even when not subscribed --- app/models/course.rb | 2 +- test/system/courses_test.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/models/course.rb b/app/models/course.rb index aab3bab18d..01d9f37650 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -305,7 +305,7 @@ def open_for_user?(user) end def visible_for_user?(user) - visible_for_all? || (visible_for_institution? && institution == user&.institution) || user&.member_of?(self) + visible_for_all? || (visible_for_institution? && institution == user&.institution) || user&.member_of?(self) || user&.zeus? end def invalidate_subscribed_members_count_cache diff --git a/test/system/courses_test.rb b/test/system/courses_test.rb index 2634335f51..33a02da27c 100644 --- a/test/system/courses_test.rb +++ b/test/system/courses_test.rb @@ -57,4 +57,14 @@ class CoursesTest < ApplicationSystemTestCase # assert redirected to login page assert_selector 'h1', text: 'Sign in' end + + test 'zeus should see activities in hidden courses' do + course = create :course, visibility: :hidden, series_count: 1, activities_per_series: 1 + + sign_in users(:zeus) + visit(course_path(:en, course.id)) + + # assert activity table is visible + assert_selector '.activity-table' + end end