Skip to content

Commit

Permalink
Optimize front page
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Mar 28, 2024
1 parent 86536c3 commit 8d4e216
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ def index
ordering = Arel.sql('hidden, LOWER(name)')
@organizations = Organization
.accepted_organizations
.with_attached_logo
.order(ordering)
.reject { |org| org.hidden? && !can?(:view_hidden_organizations, nil) || !org.visibility_allowed?(request, current_user) }
@my_organizations = Organization.taught_organizations(current_user).select { |org| org.visibility_allowed?(request, current_user) }
@my_organizations |= Organization.assisted_organizations(current_user).select { |org| org.visibility_allowed?(request, current_user) }
@my_organizations |= Organization.participated_organizations(current_user).select { |org| org.visibility_allowed?(request, current_user) }
@my_organizations = Organization.taught_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) }
@my_organizations |= Organization.assisted_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) }
@my_organizations |= Organization.participated_organizations(current_user).with_attached_logo.select { |org| org.visibility_allowed?(request, current_user) }
@my_organizations.natsort_by!(&:name)
@courses_under_initial_refresh = Course.where(initial_refresh_ready: false)
@pinned_organizations = Organization
.accepted_organizations
.where(pinned: true)
.with_attached_logo
.order(ordering)
.select { |org| org.visibility_allowed?(request, current_user) }
.reject { |org| org.hidden? && !can?(:view_hidden_organizations, nil) }
Expand Down

0 comments on commit 8d4e216

Please sign in to comment.