don't show calendar events for student groups to teachers

apparently this isn't really a thing we want anymore

test plan:
* calendar events added to student groups shouldn't appear
 on the "coming up" lists for teachers

closes #CNVS-1830

Change-Id: I972e29ecce7b8da1e01163303be1d95f27bc7754
Reviewed-on: https://gerrit.instructure.com/100319
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Chris Ward <cward@instructure.com>
This commit is contained in:
James Williams 2017-01-24 09:52:04 -07:00
parent 1a0d3a5b45
commit 67d6416e25
1 changed files with 1 additions and 12 deletions

View File

@ -2085,18 +2085,7 @@ class User < ActiveRecord::Base
# (hopefully) don't need to include cross-shard because calendar events/assignments/etc are only seached for on current shard anyway
@cached_context_codes ||=
Rails.cache.fetch([self, 'cached_context_codes', Shard.current].cache_key, :expires_in => 15.minutes) do
group_admin_course_ids =
Rails.cache.fetch([self, 'group_admin_course_ids', Shard.current].cache_key, :expires_in => 1.hour) do
# permissions are cached for an hour anyways
admin_enrolls = self.enrollments.shard(Shard.current).of_admin_type.active_by_date
Course.where(:id => admin_enrolls.select(:course_id)).to_a.select{|c| c.grants_right?(self, :manage_groups)}.map(&:id)
end
group_ids = group_admin_course_ids.any? ?
Group.active.where(:context_type => "Course", :context_id => group_admin_course_ids).pluck(:id) : []
group_ids += self.groups.active.pluck(:id)
group_ids.uniq!
group_ids = self.groups.active.pluck(:id)
cached_current_course_ids = Rails.cache.fetch([self, 'cached_current_course_ids', Shard.current].cache_key) do
# don't need an expires at because user will be touched if enrollment state changes from 'active'
self.enrollments.shard(Shard.current).active_by_date.distinct.pluck(:course_id)