hide "scores in email" notification setting if disabled by root account

fixes CNVS-21773

- enable 'Students can opt-in to receiving scores in email
 notifications' account level setting
- wait for caching (a minute or two)
- view notification preferences
- ensure the 'Include scores when alerting about grade changes'
 check box is visible
- disable the 'Students can' account level setting
- wait for cache
- view notification preferences
- ensure the 'Include scores' check box is not shown

Change-Id: I42ae9b79d736a04fe7382f33847aa70793db7f5c
Reviewed-on: https://gerrit.instructure.com/63811
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Tested-by: Jenkins
QA-Review: Adrian Russell <arussell@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
This commit is contained in:
Joel Hough 2015-09-22 15:50:14 -06:00
parent d2210350a2
commit 3a2ddb89fe
2 changed files with 9 additions and 10 deletions

View File

@ -230,7 +230,7 @@ class ProfileController < ApplicationController
json[:category] = category.category.underscore.gsub(/\s/, '_')
json[:display_name] = category.category_display_name
json[:category_description] = category.category_description
json[:option] = category.related_user_setting(@user)
json[:option] = category.related_user_setting(@user, @domain_root_account)
end
end

View File

@ -176,16 +176,15 @@ class Notification < ActiveRecord::Base
end
# Return a hash with information for a related user option if one exists.
def related_user_setting(user)
case self.category
when 'Grading'
setting = {:name => :send_scores_in_emails, :value => user.preferences[:send_scores_in_emails],
:label => t(:grading_notify_include_grade, 'Include scores when alerting about grade changes.')}
else
nil
def related_user_setting(user, root_account)
if self.category == 'Grading' && root_account.settings[:allow_sending_scores_in_emails] != false
{
name: :send_scores_in_emails,
value: user.preferences[:send_scores_in_emails],
label: t('Include scores when alerting about grade changes.'),
id: "cat_#{self.id}_option",
}
end
setting[:id] = "cat_#{self.id}_option" if setting
setting
end
def default_frequency(_user = nil)