remove deprecate_sms flag from CC display
refs VICE-1507 flag=deprecate_sms Removing the logic for preventing an sms notification will come in a future patch. Just focusing on channel displays as it required enough extra work. test plan: - add a sms communication channel for your user - navigate to /profile/communication - your sms channel should not appear - navigate to /courses/:id?view=notifications - your sms channel should not appear qa risk: low Change-Id: Ia238cdaf57ee6a8338bc65ea933ef2034a24d76d Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271900 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Rob Orton <rob@instructure.com> QA-Review: Rob Orton <rob@instructure.com> Product-Review: Rob Orton <rob@instructure.com>
This commit is contained in:
parent
19927d4fe2
commit
a5fcec34d2
|
@ -41,10 +41,6 @@ module Types
|
|||
channels = channels.reject { |cc| cc.path_type == CommunicationChannel::TYPE_PUSH }
|
||||
end
|
||||
|
||||
if Account.site_admin.feature_enabled?(:deprecate_sms)
|
||||
channels = channels.reject { |cc| cc.path_type == CommunicationChannel::TYPE_SMS }
|
||||
end
|
||||
|
||||
channels
|
||||
end
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ module Types
|
|||
def notification_preferences
|
||||
Loaders::AssociationLoader.for(User, :communication_channels).load(object).then do |comm_channels|
|
||||
{
|
||||
channels: comm_channels.unretired,
|
||||
channels: comm_channels.supported.unretired,
|
||||
user: object
|
||||
}
|
||||
end
|
||||
|
|
|
@ -387,6 +387,7 @@ class CommunicationChannel < ActiveRecord::Base
|
|||
scope :active, -> { where(workflow_state: 'active') }
|
||||
scope :bouncing, -> { where(bounce_count: RETIRE_THRESHOLD..) }
|
||||
scope :unretired, -> { where.not(workflow_state: 'retired') }
|
||||
scope :supported, -> { where.not(path_type: TYPE_SMS) }
|
||||
|
||||
# Get the list of communication channels that overrides an association's default order clause.
|
||||
# This returns an unretired and properly ordered already fetch array of CommunicationChannel objects ready for usage.
|
||||
|
|
|
@ -29,9 +29,11 @@ describe Types::NotificationPreferencesType do
|
|||
let!(:sms_channel) { communication_channel(user, {username: 'sms', path_type: CommunicationChannel::TYPE_SMS}) }
|
||||
|
||||
describe "channels" do
|
||||
it "returns the user's channels" do
|
||||
it "returns the user's supported channels" do
|
||||
result = preferences_type.resolve('notificationPreferences { channels { path } }', domain_root_account: Account.default)
|
||||
expect(result).to match_array [email_channel.path, push_channel.path, sms_channel.path]
|
||||
# sms is not considered a supported communication channel
|
||||
expect(result).to_not include sms_channel.path
|
||||
expect(result).to match_array [email_channel.path, push_channel.path]
|
||||
end
|
||||
|
||||
context "push notifications are disabled on the account" do
|
||||
|
@ -42,23 +44,7 @@ describe Types::NotificationPreferencesType do
|
|||
it "does not return push channels" do
|
||||
result = preferences_type.resolve('notificationPreferences { channels { path } }', domain_root_account: Account.default)
|
||||
expect(result).to_not include push_channel.path
|
||||
expect(result).to match_array [email_channel.path, sms_channel.path]
|
||||
end
|
||||
end
|
||||
|
||||
context "deprecate_sms feature flag is enabled" do
|
||||
before do
|
||||
Account.site_admin.enable_feature!(:deprecate_sms)
|
||||
end
|
||||
|
||||
after do
|
||||
Account.site_admin.disable_feature!(:deprecate_sms)
|
||||
end
|
||||
|
||||
it "does not return sms channels" do
|
||||
result = preferences_type.resolve('notificationPreferences { channels { path } }', domain_root_account: Account.default)
|
||||
expect(result).to_not include sms_channel.path
|
||||
expect(result).to match_array [email_channel.path, push_channel.path]
|
||||
expect(result).to match_array [email_channel.path]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -813,4 +813,13 @@ describe CommunicationChannel do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ".supported" do
|
||||
let(:user) { User.create! }
|
||||
let!(:sms_channel) { communication_channel(user, {username: 'sms', path_type: CommunicationChannel::TYPE_SMS}) }
|
||||
|
||||
it "filters sms channels" do
|
||||
expect(CommunicationChannel.supported).to match_array []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -66,29 +66,12 @@ describe "profile communication settings" do
|
|||
expect(fj("th[scope='col'] span:contains('nobody@example.com')")).to be
|
||||
end
|
||||
|
||||
it "should display an SMS number as channel" do
|
||||
it "shouldn't display a SMS number as channel" do
|
||||
communication_channel(@user, {username: '8011235555@vtext.com', path_type: 'sms', active_cc: true})
|
||||
|
||||
get "/profile/communication"
|
||||
expect(fj("span:contains('sms')")).to be
|
||||
expect(fxpath("//span[contains(text(),'8011235555@vtext')]")).to be
|
||||
end
|
||||
|
||||
context 'deprecate_sms is enabled' do
|
||||
before do
|
||||
Account.site_admin.enable_feature!(:deprecate_sms)
|
||||
end
|
||||
|
||||
after do
|
||||
Account.site_admin.disable_feature!(:deprecate_sms)
|
||||
end
|
||||
|
||||
it "shouldn't display a SMS number as channel" do
|
||||
communication_channel(@user, {username: '8011235555@vtext.com', path_type: 'sms', active_cc: true})
|
||||
|
||||
get "/profile/communication"
|
||||
expect(f("thead")).not_to contain_jqcss("span:contains('sms')")
|
||||
expect(f("thead")).not_to contain_jqcss("span:contains('8011235555@vtext.com')")
|
||||
end
|
||||
expect(f("thead")).not_to contain_jqcss("span:contains('sms')")
|
||||
expect(f("thead")).not_to contain_jqcss("span:contains('8011235555@vtext.com')")
|
||||
end
|
||||
|
||||
it "should save a user-pref checkbox change" do
|
||||
|
|
Loading…
Reference in New Issue