remove feature mute_notifications_by_course
test plan - specs should pass fixes VICE-998 flag=mute_notifications_by_course Change-Id: I2dc572a8013817bd1e3ae2ace54e52932e463cdd Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254038 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Matthew Lemon <mlemon@instructure.com> Product-Review: Matthew Lemon <mlemon@instructure.com> QA-Review: Matthew Lemon <mlemon@instructure.com>
This commit is contained in:
parent
410019519e
commit
1240475b49
|
@ -2021,10 +2021,7 @@ class CoursesController < ApplicationController
|
||||||
js_env(:SHOW_ANNOUNCEMENTS => true, :ANNOUNCEMENT_LIMIT => @context.home_page_announcement_limit)
|
js_env(:SHOW_ANNOUNCEMENTS => true, :ANNOUNCEMENT_LIMIT => @context.home_page_announcement_limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
if @domain_root_account&.feature_enabled?(:mute_notifications_by_course) && params[:view] == 'notifications'
|
return render_course_notification_settings if params[:view] == 'notifications'
|
||||||
render_course_notification_settings
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
@contexts = [@context]
|
@contexts = [@context]
|
||||||
case @course_home_view
|
case @course_home_view
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @context_enrollment && @domain_root_account.try(:feature_enabled?, :mute_notifications_by_course) %>
|
<% if @context_enrollment %>
|
||||||
<a class="btn button-sidebar-wide" href="<%= context_url(@context, :context_url, :view => 'notifications') %>">
|
<a class="btn button-sidebar-wide" href="<%= context_url(@context, :context_url, :view => 'notifications') %>">
|
||||||
<i class="icon-<%= @course_notifications_enabled ? "unmuted" : "muted" %>"></i>
|
<i class="icon-<%= @course_notifications_enabled ? "unmuted" : "muted" %>"></i>
|
||||||
<%= t('links.view_course_notification_settings', %{View Course Notifications}) %>
|
<%= t('links.view_course_notification_settings', %{View Course Notifications}) %>
|
||||||
|
|
|
@ -30,13 +30,6 @@ hide_course_sections_from_students:
|
||||||
Allows teachers to hide course sections from students on the People page when there is more than one section in the course.
|
Allows teachers to hide course sections from students on the People page when there is more than one section in the course.
|
||||||
applies_to: RootAccount
|
applies_to: RootAccount
|
||||||
|
|
||||||
mute_notifications_by_course:
|
|
||||||
state: hidden
|
|
||||||
display_name: Mute notifications by course
|
|
||||||
description: |-
|
|
||||||
Allows users to mute notifications on a course level granularity.
|
|
||||||
applies_to: RootAccount
|
|
||||||
|
|
||||||
notification_granular_course_preferences:
|
notification_granular_course_preferences:
|
||||||
state: hidden
|
state: hidden
|
||||||
display_name: Course level overrides for notification preferences
|
display_name: Course level overrides for notification preferences
|
||||||
|
|
|
@ -44,7 +44,6 @@ class NotificationMessageCreator
|
||||||
if course_id && root_account_id
|
if course_id && root_account_id
|
||||||
@account = Account.new(id: root_account_id)
|
@account = Account.new(id: root_account_id)
|
||||||
@course = Course.new(id: course_id)
|
@course = Course.new(id: course_id)
|
||||||
@mute_notifications_by_course_enabled = @account.feature_enabled?(:mute_notifications_by_course)
|
|
||||||
@override_preferences_enabled = Account.site_admin.feature_enabled?(:notification_granular_course_preferences)
|
@override_preferences_enabled = Account.site_admin.feature_enabled?(:notification_granular_course_preferences)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -109,9 +108,9 @@ class NotificationMessageCreator
|
||||||
# if the message is not summarizable?, it is in a context that notifications
|
# if the message is not summarizable?, it is in a context that notifications
|
||||||
# cannot be disabled, so return true before checking.
|
# cannot be disabled, so return true before checking.
|
||||||
return true unless @notification.summarizable?
|
return true unless @notification.summarizable?
|
||||||
if @mute_notifications_by_course_enabled
|
|
||||||
return NotificationPolicyOverride.enabled_for(user, context)
|
return NotificationPolicyOverride.enabled_for(user, context) if context
|
||||||
end
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -642,8 +642,7 @@ describe CoursesController do
|
||||||
@teacher = course_with_user("TeacherEnrollment", course: @course, active_all: true).user
|
@teacher = course_with_user("TeacherEnrollment", course: @course, active_all: true).user
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'shows the course notification settings page if enabled' do
|
it 'shows the course notification settings page' do
|
||||||
Account.default.enable_feature!(:mute_notifications_by_course)
|
|
||||||
user_session(@teacher)
|
user_session(@teacher)
|
||||||
get 'show', params: {id: @course.id, view: 'notifications'}
|
get 'show', params: {id: @course.id, view: 'notifications'}
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
|
@ -654,18 +653,6 @@ describe CoursesController do
|
||||||
end
|
end
|
||||||
expect(contains_js_bundle).to be true
|
expect(contains_js_bundle).to be true
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not show the course notification settings page if disabled' do
|
|
||||||
user_session(@teacher)
|
|
||||||
get 'show', params: {id: @course.id, view: 'notifications'}
|
|
||||||
expect(response).to be_successful
|
|
||||||
|
|
||||||
contains_js_bundle = false
|
|
||||||
assigns['js_bundles'].each do |js_bundle|
|
|
||||||
contains_js_bundle = js_bundle.include? :course_notification_settings_show if js_bundle.include? :course_notification_settings_show
|
|
||||||
end
|
|
||||||
expect(contains_js_bundle).to be false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ RSpec.describe Mutations::UpdateNotificationPreferences do
|
||||||
@course = @account.courses.create!
|
@course = @account.courses.create!
|
||||||
@teacher = @course.enroll_teacher(User.create!, enrollment_state: 'active').user
|
@teacher = @course.enroll_teacher(User.create!, enrollment_state: 'active').user
|
||||||
@student = @course.enroll_student(User.create!, enrollemnt_state: 'active').user
|
@student = @course.enroll_student(User.create!, enrollemnt_state: 'active').user
|
||||||
@account.enable_feature!(:mute_notifications_by_course)
|
|
||||||
communication_channel(@teacher, {username: 'two@example.com', active_cc: true})
|
communication_channel(@teacher, {username: 'two@example.com', active_cc: true})
|
||||||
@notification = Notification.create!(:name => "Assignment Created", :subject => "Test", :category => 'Due Date')
|
@notification = Notification.create!(:name => "Assignment Created", :subject => "Test", :category => 'Due Date')
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,7 +128,6 @@ describe NotificationMessageCreator do
|
||||||
|
|
||||||
it 'does not send a notification when policy override is disabled for a course' do
|
it 'does not send a notification when policy override is disabled for a course' do
|
||||||
notification_set(notification_opts: { :category => "Announcement" })
|
notification_set(notification_opts: { :category => "Announcement" })
|
||||||
@course.root_account.enable_feature!(:mute_notifications_by_course)
|
|
||||||
NotificationPolicyOverride.enable_for_context(@user, @course, enable: false)
|
NotificationPolicyOverride.enable_for_context(@user, @course, enable: false)
|
||||||
data = { course_id: @course.id, root_account_id: @course.root_account_id }
|
data = { course_id: @course.id, root_account_id: @course.root_account_id }
|
||||||
messages = NotificationMessageCreator.new(@notification, @assignment, to_list: @user, data: data).create_message
|
messages = NotificationMessageCreator.new(@notification, @assignment, to_list: @user, data: data).create_message
|
||||||
|
@ -137,7 +136,6 @@ describe NotificationMessageCreator do
|
||||||
|
|
||||||
it 'does send a notification when course_id is not passed in' do
|
it 'does send a notification when course_id is not passed in' do
|
||||||
notification_set(notification_opts: { :category => "Announcement" })
|
notification_set(notification_opts: { :category => "Announcement" })
|
||||||
@course.root_account.enable_feature!(:mute_notifications_by_course)
|
|
||||||
NotificationPolicyOverride.enable_for_context(@user, @course, enable: false)
|
NotificationPolicyOverride.enable_for_context(@user, @course, enable: false)
|
||||||
data = { root_account_id: @course.root_account_id }
|
data = { root_account_id: @course.root_account_id }
|
||||||
messages = NotificationMessageCreator.new(@notification, @assignment, to_list: @user, data: data).create_message
|
messages = NotificationMessageCreator.new(@notification, @assignment, to_list: @user, data: data).create_message
|
||||||
|
@ -154,7 +152,6 @@ describe NotificationMessageCreator do
|
||||||
|
|
||||||
it 'does send other notifications when policy override is in effect' do
|
it 'does send other notifications when policy override is in effect' do
|
||||||
notification_set(notification_opts: { :category => "Registration" })
|
notification_set(notification_opts: { :category => "Registration" })
|
||||||
@course.root_account.enable_feature!(:mute_notifications_by_course)
|
|
||||||
NotificationPolicyOverride.enable_for_context(@user, @course, enable: false)
|
NotificationPolicyOverride.enable_for_context(@user, @course, enable: false)
|
||||||
data = { course_id: @course.id, root_account_id: @course.root_account_id }
|
data = { course_id: @course.id, root_account_id: @course.root_account_id }
|
||||||
messages = NotificationMessageCreator.new(@notification, @assignment, to_list: @user, data: data).create_message
|
messages = NotificationMessageCreator.new(@notification, @assignment, to_list: @user, data: data).create_message
|
||||||
|
@ -490,7 +487,6 @@ describe NotificationMessageCreator do
|
||||||
context "notification policy overrides" do
|
context "notification policy overrides" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
notification_set({notification_opts: {category: 'PandaExpressTime'}})
|
notification_set({notification_opts: {category: 'PandaExpressTime'}})
|
||||||
@course.root_account.enable_feature!(:mute_notifications_by_course)
|
|
||||||
Account.site_admin.enable_feature!(:notification_granular_course_preferences)
|
Account.site_admin.enable_feature!(:notification_granular_course_preferences)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue