add double enqueueing of notifications

fixes CNVS-27200

Test Plan:
- generate a notification with the setting and feature
  flag on.
- Notice you get the notification twice.

Change-Id: I91afbda437b730c814969f36916c8176083a926c
Reviewed-on: https://gerrit.instructure.com/72390
Reviewed-by: Christina Wuest <cwuest@instructure.com>
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
This commit is contained in:
Steven Burnett 2016-02-17 14:42:40 -07:00
parent 098e6f9c85
commit 13e290691f
2 changed files with 10 additions and 0 deletions

View File

@ -562,6 +562,9 @@ class Message < ActiveRecord::Base
end
if user && user.account.feature_enabled?(:notification_service) && path_type != "yo"
if Setting.get("notification_service_traffic", '').present?
send(delivery_method)
end
enqueue_to_sqs
else
send(delivery_method)

View File

@ -74,5 +74,12 @@ describe NotificationService do
expect(@message.transmission_errors).to include("AWS::SQS::Errors::ServiceError")
expect(@message.workflow_state).to eql("staged")
end
it "will send to both services" do
Setting.set("notification_service_traffic", "true")
@queue.expects(:send_message).once
@message.path_type = "email"
@message.expects(:deliver_via_email).once
expect{@message.deliver}.not_to raise_error
end
end
end