Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow zeus to see activities in hidden courses even when not subscribed #5986

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions test/system/courses_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading