@@ -10,17 +10,17 @@ def index
10
10
@organizations = Organization
11
11
. accepted_organizations
12
12
. order ( ordering )
13
- . reject { |org | org . hidden? && !can? ( :view_hidden_organizations , nil ) || !org . visibility_allowed? ( request ) }
14
- @my_organizations = Organization . taught_organizations ( current_user ) . select { |org | org . visibility_allowed? ( request ) }
15
- @my_organizations |= Organization . assisted_organizations ( current_user ) . select { |org | org . visibility_allowed? ( request ) }
16
- @my_organizations |= Organization . participated_organizations ( current_user ) . select { |org | org . visibility_allowed? ( request ) }
13
+ . reject { |org | org . hidden? && !can? ( :view_hidden_organizations , nil ) || !org . visibility_allowed? ( request , current_user ) }
14
+ @my_organizations = Organization . taught_organizations ( current_user ) . select { |org | org . visibility_allowed? ( request , current_user ) }
15
+ @my_organizations |= Organization . assisted_organizations ( current_user ) . select { |org | org . visibility_allowed? ( request , current_user ) }
16
+ @my_organizations |= Organization . participated_organizations ( current_user ) . select { |org | org . visibility_allowed? ( request , current_user ) }
17
17
@my_organizations . natsort_by! ( &:name )
18
18
@courses_under_initial_refresh = Course . where ( initial_refresh_ready : false )
19
19
@pinned_organizations = Organization
20
20
. accepted_organizations
21
21
. where ( pinned : true )
22
22
. order ( ordering )
23
- . select { |org | org . visibility_allowed? ( request ) }
23
+ . select { |org | org . visibility_allowed? ( request , current_user ) }
24
24
. reject { |org | org . hidden? && !can? ( :view_hidden_organizations , nil ) }
25
25
render layout : 'landing'
26
26
end
@@ -100,7 +100,7 @@ def percent_completed_hash(courses, user)
100
100
101
101
def set_organization
102
102
@organization = Organization . find_by ( slug : params [ :id ] )
103
- unauthorized! unless @organization . visibility_allowed? ( request )
103
+ unauthorized! unless @organization . visibility_allowed? ( request , current_user )
104
104
raise ActiveRecord ::RecordNotFound , 'Invalid organization id' if @organization . nil?
105
105
end
106
106
0 commit comments