optimize group loading on courses#show page
Change-Id: I8db43095d2b6f71822624dc2b3134caa1f8748f4 Reviewed-on: https://gerrit.instructure.com/2480 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Brian Whitmer <brian@instructure.com>
This commit is contained in:
parent
18cd4a4491
commit
62f22d9df7
|
@ -499,7 +499,11 @@ class CoursesController < ApplicationController
|
|||
else
|
||||
@active_tab = "home"
|
||||
@contexts = [@context]
|
||||
@contexts += @context.groups.select{|g| g.grants_right?(@current_user, session, :manage) }
|
||||
if @context.grants_right?(@current_user, session, :manage_groups)
|
||||
@contexts += @context.groups
|
||||
else
|
||||
@contexts += @user_groups
|
||||
end
|
||||
@current_conferences = @context.web_conferences.select{|c| c.active? && c.users.include?(@current_user) }
|
||||
end
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ class Group < ActiveRecord::Base
|
|||
private :ensure_defaults
|
||||
|
||||
set_policy do
|
||||
given { |user| user && self.participating_users.include?(user) }
|
||||
given { |user| user && self.participating_group_memberships.find_by_user_id(user.id) }
|
||||
set { can :read and can :read_roster and can :manage and can :manage_content and can :manage_students and can :manage_admin_users and
|
||||
can :manage_files and can :moderate_forum and
|
||||
can :post_to_forum and
|
||||
|
@ -273,7 +273,7 @@ class Group < ActiveRecord::Base
|
|||
given { |user, session| self.context && self.context.grants_right?(user, session, :view_group_pages) }
|
||||
set { can :read and can :read_roster }
|
||||
end
|
||||
|
||||
|
||||
def file_structure_for(user)
|
||||
User.file_structure_for(self, user)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue