From aefb45f1ee7ec870b90e7ab5e7a891f9636b26d0 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 12 Aug 2020 15:26:58 +1000 Subject: [PATCH 01/12] Add option to email to ignore the deny list It doesn't do anything or get populated properly --- app/services/email_services/create.rb | 4 +++- ...812050040_add_ignore_deny_list_to_emails.rb | 6 ++++++ db/schema.rb | 3 ++- lib/cuttlefish_smtp_server.rb | 4 +++- spec/factories/emails.rb | 1 + spec/lib/filters/master_spec.rb | 5 +---- spec/lib/send_email_worker_spec.rb | 18 +----------------- 7 files changed, 17 insertions(+), 24 deletions(-) create mode 100644 db/migrate/20200812050040_add_ignore_deny_list_to_emails.rb diff --git a/app/services/email_services/create.rb b/app/services/email_services/create.rb index 39c678d1c..e2f50630b 100644 --- a/app/services/email_services/create.rb +++ b/app/services/email_services/create.rb @@ -40,7 +40,9 @@ def call email = Email.create!( to: mail.to, data: mail.to_s, - app_id: app_id + app_id: app_id, + # TODO: Add the option to set this + ignore_deny_list: false ) SendEmailWorker.perform_async(email.id) diff --git a/db/migrate/20200812050040_add_ignore_deny_list_to_emails.rb b/db/migrate/20200812050040_add_ignore_deny_list_to_emails.rb new file mode 100644 index 000000000..397235352 --- /dev/null +++ b/db/migrate/20200812050040_add_ignore_deny_list_to_emails.rb @@ -0,0 +1,6 @@ +class AddIgnoreDenyListToEmails < ActiveRecord::Migration[5.2] + def change + add_column :emails, :ignore_deny_list, :boolean, null: false, default: false + change_column_default :emails, :ignore_deny_list, from: false, to: nil + end +end diff --git a/db/schema.rb b/db/schema.rb index fe39950b0..445dcf600 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_10_11_045125) do +ActiveRecord::Schema.define(version: 2020_08_12_050040) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -128,6 +128,7 @@ t.string "data_hash", limit: 255 t.integer "app_id", null: false t.string "subject", limit: 255 + t.boolean "ignore_deny_list", null: false t.index ["app_id"], name: "index_emails_on_app_id" t.index ["created_at"], name: "index_emails_on_created_at" t.index ["from_address_id"], name: "index_emails_on_from_address_id" diff --git a/lib/cuttlefish_smtp_server.rb b/lib/cuttlefish_smtp_server.rb index 509028273..6056bfcc0 100644 --- a/lib/cuttlefish_smtp_server.rb +++ b/lib/cuttlefish_smtp_server.rb @@ -175,7 +175,9 @@ def receive_message email = Email.create!( to: current.recipients, data: current.data, - app_id: current.app_id + app_id: current.app_id, + # TODO: Set this based on a special header we pass + ignore_deny_list: false ) SendEmailWorker.perform_async(email.id) diff --git a/spec/factories/emails.rb b/spec/factories/emails.rb index 07250ac88..89533dd65 100644 --- a/spec/factories/emails.rb +++ b/spec/factories/emails.rb @@ -3,5 +3,6 @@ FactoryBot.define do factory :email do app + ignore_deny_list { false } end end diff --git a/spec/lib/filters/master_spec.rb b/spec/lib/filters/master_spec.rb index d2a0687b9..a3e1244e8 100644 --- a/spec/lib/filters/master_spec.rb +++ b/spec/lib/filters/master_spec.rb @@ -14,10 +14,7 @@ end it do - app = App.create!(name: "Test") - email = Email.create!(app_id: app.id) - delivery = Delivery.create!(email: email, app: app) - mail2 = Filters::Master.new(delivery: delivery).filter_mail(mail) + mail2 = Filters::Master.new(delivery: create(:delivery)).filter_mail(mail) expect(Nokogiri::HTML(mail2.html_part.decoded).at("p").inner_text).to eq( "vašem" ) diff --git a/spec/lib/send_email_worker_spec.rb b/spec/lib/send_email_worker_spec.rb index 0cdfadae4..b5ae76a67 100644 --- a/spec/lib/send_email_worker_spec.rb +++ b/spec/lib/send_email_worker_spec.rb @@ -4,23 +4,7 @@ require "ostruct" describe SendEmailWorker, "#perform" do - let(:team) { Team.create! } - let(:app) { team.apps.create!(name: "test") } - let(:mail) do - Mail.new do - subject "Hello!" - from "Matthew Landauer " - to "Some other place " - body "Let's say some stuff" - end - end - let(:email) do - Email.create!( - to: ["foo@bar.com"], - data: mail.encoded, - app_id: app.id - ) - end + let(:email) { create(:email) } it "should forward the email information" do expect(EmailServices::Send).to receive(:call) From f12a886491b686dd31ed5dac9cbdb24350c8f980 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 12 Aug 2020 15:34:44 +1000 Subject: [PATCH 02/12] Add option to set ignore_deny_list in API --- app/graphql/mutations/create_emails.rb | 8 ++++++-- app/services/email_services/create.rb | 8 ++++---- spec/services/email_services/create_spec.rb | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/graphql/mutations/create_emails.rb b/app/graphql/mutations/create_emails.rb index face6812e..a093f43cc 100644 --- a/app/graphql/mutations/create_emails.rb +++ b/app/graphql/mutations/create_emails.rb @@ -19,11 +19,14 @@ class CreateEmails < Mutations::Base argument :text_part, String, required: false argument :html_part, String, required: false + argument :ignore_deny_list, Boolean, required: false + field :emails, [Types::Email], null: true # rubocop:disable Naming/MethodParameterName def resolve( - app_id:, from:, to:, cc: [], subject:, text_part: nil, html_part: nil + app_id:, from:, to:, cc: [], subject:, text_part: nil, html_part: nil, + ignore_deny_list: false ) create_email = EmailServices::Create.call( app_id: app_id, @@ -32,7 +35,8 @@ def resolve( cc: cc, subject: subject, text_part: text_part, - html_part: html_part + html_part: html_part, + ignore_deny_list: ignore_deny_list ) # TODO: Error checking { diff --git a/app/services/email_services/create.rb b/app/services/email_services/create.rb index e2f50630b..3c559c9f6 100644 --- a/app/services/email_services/create.rb +++ b/app/services/email_services/create.rb @@ -3,7 +3,7 @@ module EmailServices class Create < ApplicationService # rubocop:disable Naming/MethodParameterName - def initialize(app_id:, from:, to:, cc:, subject:, text_part:, html_part:) + def initialize(app_id:, from:, to:, cc:, subject:, text_part:, html_part:, ignore_deny_list:) super() @app_id = app_id @from = from @@ -12,6 +12,7 @@ def initialize(app_id:, from:, to:, cc:, subject:, text_part:, html_part:) @subject = subject @text_part = text_part @html_part = html_part + @ignore_deny_list = ignore_deny_list end # rubocop:enable Naming/MethodParameterName @@ -41,8 +42,7 @@ def call to: mail.to, data: mail.to_s, app_id: app_id, - # TODO: Add the option to set this - ignore_deny_list: false + ignore_deny_list: ignore_deny_list ) SendEmailWorker.perform_async(email.id) @@ -52,6 +52,6 @@ def call private - attr_reader :app_id, :from, :to, :cc, :subject, :text_part, :html_part + attr_reader :app_id, :from, :to, :cc, :subject, :text_part, :html_part, :ignore_deny_list end end diff --git a/spec/services/email_services/create_spec.rb b/spec/services/email_services/create_spec.rb index 10b709eb0..d539c48a8 100644 --- a/spec/services/email_services/create_spec.rb +++ b/spec/services/email_services/create_spec.rb @@ -13,7 +13,8 @@ subject: "Test", text_part: "Hello. How are you?", html_part: "

Hello. How are you?

", - app_id: app.id + app_id: app.id, + ignore_deny_list: false ) end From 2cd935ce55f79412b9fea44a0643748c839d5598 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 12 Aug 2020 16:21:12 +1000 Subject: [PATCH 03/12] Can now set special header in email to ignore_deny_list --- lib/cuttlefish_smtp_server.rb | 8 ++- spec/lib/cuttlefish_smtp_server_spec.rb | 92 +++++++++++++++++-------- 2 files changed, 68 insertions(+), 32 deletions(-) diff --git a/lib/cuttlefish_smtp_server.rb b/lib/cuttlefish_smtp_server.rb index 6056bfcc0..038592d83 100644 --- a/lib/cuttlefish_smtp_server.rb +++ b/lib/cuttlefish_smtp_server.rb @@ -172,12 +172,16 @@ def receive_message # TODO: No need to capture current.sender, current.received, # current.completed_at because we're not passing it on + # Now check for special headers + m = Mail.new(current.data) + h = m.header["X-Cuttlefish-Ignore-Deny-List"] + ignore_deny_list = (!h.nil? && h.value == "true") + email = Email.create!( to: current.recipients, data: current.data, app_id: current.app_id, - # TODO: Set this based on a special header we pass - ignore_deny_list: false + ignore_deny_list: ignore_deny_list ) SendEmailWorker.perform_async(email.id) diff --git a/spec/lib/cuttlefish_smtp_server_spec.rb b/spec/lib/cuttlefish_smtp_server_spec.rb index c8d8c9887..f70ad9972 100644 --- a/spec/lib/cuttlefish_smtp_server_spec.rb +++ b/spec/lib/cuttlefish_smtp_server_spec.rb @@ -97,37 +97,69 @@ end end describe "#receive_message" do - it do - allow(EmailServices::Send).to receive(:call) - data = [ - "MIME-Version: 1.0", - "Content-Type: text/plain; charset=\"utf-8\"", - "Content-Transfer-Encoding: 8bit", - "Subject: [WriteIT] Message: asdasd", - "From: Felipe , " \ - "Matthew ", - "To: felipe@fiera-feroz.cl", - "Date: Fri, 13 Mar 2015 14:42:20 -0000", - "Message-ID: <20150313144220.12848.46019@paro-taktsang>", - "", - "Contra toda autoridad!...excepto mi mamá!" - ].join("\r\n") - # Simulate the encoding that we would assume when the data is received - # over the wire so to speak - data.force_encoding("ASCII-8BIT") - connection.receive_sender("ciudadanoi@email.org") - connection.receive_recipient("Felipe ") - connection.receive_recipient("Matthew ") - connection.receive_plain_auth(app.smtp_username, app.smtp_password) - connection.current.data = data - Sidekiq::Testing.inline! do - connection.receive_message + context "message with UTF8 encoding" do + let(:data) do + data = [ + "MIME-Version: 1.0", + "Content-Type: text/plain; charset=\"utf-8\"", + "Content-Transfer-Encoding: 8bit", + "Subject: [WriteIT] Message: asdasd", + "From: Felipe , " \ + "Matthew ", + "To: felipe@fiera-feroz.cl", + "Date: Fri, 13 Mar 2015 14:42:20 -0000", + "Message-ID: <20150313144220.12848.46019@paro-taktsang>", + "", + "Contra toda autoridad!...excepto mi mamá!" + ].join("\r\n") + # Simulate the encoding that we would assume when the data is received + # over the wire so to speak + data.force_encoding("ASCII-8BIT") + data + end + + it do + allow(EmailServices::Send).to receive(:call) + connection.receive_sender("ciudadanoi@email.org") + connection.receive_recipient("Felipe ") + connection.receive_recipient("Matthew ") + connection.receive_plain_auth(app.smtp_username, app.smtp_password) + connection.current.data = data + Sidekiq::Testing.inline! do + connection.receive_message + end + expect(Email.count).to eq 1 + mail = Email.first + expect(Mail.new(mail.data).decoded).to eq( + "Contra toda autoridad!...excepto mi mamá!" + ) + expect(mail.ignore_deny_list).to be false + end + end + + context "message with special header" do + let(:data) do + [ + "Subject: Hello", + "From: foo@bar.com", + "To: wibble@wobble.com", + "X-Cuttlefish-Ignore-Deny-List: true", + "", + "Hello!" + ].join("\r\n") + end + + it do + connection.receive_recipient("") + connection.receive_plain_auth(app.smtp_username, app.smtp_password) + connection.current.data = data + Sidekiq::Testing.inline! do + connection.receive_message + end + expect(Email.count).to eq 1 + mail = Email.first + expect(mail.ignore_deny_list).to be true end - expect(Email.count).to eq 1 - mail = Email.first - expect(Mail.new(mail.data).decoded).to eq( - "Contra toda autoridad!...excepto mi mamá!" - ) end end end From 5e3843a5db3a91480a4456576cd56362dc5cef76 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 12 Aug 2020 16:32:29 +1000 Subject: [PATCH 04/12] Don't pass on special header --- lib/cuttlefish_smtp_server.rb | 5 ++++- spec/lib/cuttlefish_smtp_server_spec.rb | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/cuttlefish_smtp_server.rb b/lib/cuttlefish_smtp_server.rb index 038592d83..f4989170e 100644 --- a/lib/cuttlefish_smtp_server.rb +++ b/lib/cuttlefish_smtp_server.rb @@ -177,9 +177,12 @@ def receive_message h = m.header["X-Cuttlefish-Ignore-Deny-List"] ignore_deny_list = (!h.nil? && h.value == "true") + # Remove header + m.header["X-Cuttlefish-Ignore-Deny-List"] = nil + email = Email.create!( to: current.recipients, - data: current.data, + data: m.to_s, app_id: current.app_id, ignore_deny_list: ignore_deny_list ) diff --git a/spec/lib/cuttlefish_smtp_server_spec.rb b/spec/lib/cuttlefish_smtp_server_spec.rb index f70ad9972..41afde0b2 100644 --- a/spec/lib/cuttlefish_smtp_server_spec.rb +++ b/spec/lib/cuttlefish_smtp_server_spec.rb @@ -140,10 +140,16 @@ context "message with special header" do let(:data) do [ - "Subject: Hello", + "Date: Wed, 12 Aug 2020 06:25:22 +0000", "From: foo@bar.com", "To: wibble@wobble.com", "X-Cuttlefish-Ignore-Deny-List: true", + "Message-ID: <1.mail>", + "Subject: Hello", + "Mime-Version: 1.0", + "Content-Type: text/plain;", + " charset=UTF-8", + "Content-Transfer-Encoding: 7bit", "", "Hello!" ].join("\r\n") @@ -159,6 +165,20 @@ expect(Email.count).to eq 1 mail = Email.first expect(mail.ignore_deny_list).to be true + # The header should have been removed + expect(mail.data).to eq [ + "Date: Wed, 12 Aug 2020 06:25:22 +0000", + "From: foo@bar.com", + "To: wibble@wobble.com", + "Message-ID: <1.mail>", + "Subject: Hello", + "Mime-Version: 1.0", + "Content-Type: text/plain;", + " charset=UTF-8", + "Content-Transfer-Encoding: 7bit", + "", + "Hello!" + ].join("\r\n") end end end From 086475a369cef83599758d3236932c878ace6e1c Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 12 Aug 2020 16:33:32 +1000 Subject: [PATCH 05/12] Extract value --- lib/cuttlefish_smtp_server.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/cuttlefish_smtp_server.rb b/lib/cuttlefish_smtp_server.rb index f4989170e..ec0f7fb89 100644 --- a/lib/cuttlefish_smtp_server.rb +++ b/lib/cuttlefish_smtp_server.rb @@ -165,6 +165,8 @@ def process_data_line(line) end end + IGNORE_DENY_LIST_HEADER = "X-Cuttlefish-Ignore-Deny-List" + def receive_message current.received = true current.completed_at = Time.now @@ -174,11 +176,11 @@ def receive_message # Now check for special headers m = Mail.new(current.data) - h = m.header["X-Cuttlefish-Ignore-Deny-List"] + h = m.header[IGNORE_DENY_LIST_HEADER] ignore_deny_list = (!h.nil? && h.value == "true") # Remove header - m.header["X-Cuttlefish-Ignore-Deny-List"] = nil + m.header[IGNORE_DENY_LIST_HEADER] = nil email = Email.create!( to: current.recipients, From 42d0d5ded10ab11e7801facd18b0cad7ead94b78 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 12 Aug 2020 16:46:13 +1000 Subject: [PATCH 06/12] Now respect ignore_deny_list setting --- app/models/delivery.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/delivery.rb b/app/models/delivery.rb index 7153b56b3..775dac2d8 100644 --- a/app/models/delivery.rb +++ b/app/models/delivery.rb @@ -29,7 +29,7 @@ def send? # If there is no team there is no deny list # In concrete terms the internal cuttlefish app doesn't have a deny # list and isn't part of a team - app.team.nil? || address.deny_lists.find_by(team_id: app.team.id).nil? + app.team.nil? || email.ignore_deny_list || address.deny_lists.find_by(team_id: app.team.id).nil? end def add_open_event(request) From d2355f89b0e877d3c88cd45b61258ce071dfa2a4 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 12 Aug 2020 17:45:11 +1000 Subject: [PATCH 07/12] Add crude documentation about the new special header --- app/views/documentation/_special_headers.haml | 29 +++++++++++++++++++ app/views/documentation/index.html.haml | 1 + 2 files changed, 30 insertions(+) create mode 100644 app/views/documentation/_special_headers.haml diff --git a/app/views/documentation/_special_headers.haml b/app/views/documentation/_special_headers.haml new file mode 100644 index 000000000..750757501 --- /dev/null +++ b/app/views/documentation/_special_headers.haml @@ -0,0 +1,29 @@ +%h3 Special Headers + +%p + By setting special headers in the email content you can make some special things happen. + There is currently only one setting. + +%h4 X-Cuttlefish-Ignore-Deny-List + +%p + If you set this to "true", the email will get sent even if the destination + is on the "deny list". Only use this in very exceptional circumstances where + you have a low volume of email going to an email address that you're very + confident should work and you absolutely don't want emails to not get sent. + +%p + One example of this is sending emails to a known and fixed email address of + a government agency. We *really* want those emails to arrive as much as + possible. + +%p An example of the header in use: + +:coderay + #!plain + From: foo@bar.com + To: wibble@wobble.com + X-Cuttlefish-Ignore-Deny-List: true + Subject: Hello + + Hello! diff --git a/app/views/documentation/index.html.haml b/app/views/documentation/index.html.haml index ed888f403..f590e5077 100644 --- a/app/views/documentation/index.html.haml +++ b/app/views/documentation/index.html.haml @@ -21,6 +21,7 @@ - @apps.each do |app| .tab-pane{id: "app-#{app.id}", class: ("active" if app == @active_app)} = render partial: "general", locals: {app: app} + = render partial: "special_headers", locals: {app: app} = render partial: "rails", locals: {app: app} = render partial: "php", locals: {app: app} = render partial: "django", locals: {app: app} From 73e9bc29efca9b4c253b75609145b77fffc3966e Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 12 Aug 2020 19:47:01 +1000 Subject: [PATCH 08/12] Explain that the deny list still gets populated --- app/views/documentation/_special_headers.haml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/documentation/_special_headers.haml b/app/views/documentation/_special_headers.haml index 750757501..4f591c3ed 100644 --- a/app/views/documentation/_special_headers.haml +++ b/app/views/documentation/_special_headers.haml @@ -8,7 +8,11 @@ %p If you set this to "true", the email will get sent even if the destination - is on the "deny list". Only use this in very exceptional circumstances where + address is on the "deny list". Note that if the email hard bounces the destination + address will still get added to the deny list. + +%p + Only use this in very exceptional circumstances where you have a low volume of email going to an email address that you're very confident should work and you absolutely don't want emails to not get sent. From c561eb6a77627d2a4808c2246337642136e06d8a Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 13 Aug 2020 10:04:13 +1000 Subject: [PATCH 09/12] boldify a word --- app/views/documentation/_special_headers.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/documentation/_special_headers.haml b/app/views/documentation/_special_headers.haml index 4f591c3ed..30fd88797 100644 --- a/app/views/documentation/_special_headers.haml +++ b/app/views/documentation/_special_headers.haml @@ -18,7 +18,7 @@ %p One example of this is sending emails to a known and fixed email address of - a government agency. We *really* want those emails to arrive as much as + a government agency. We really want those emails to arrive as much as possible. %p An example of the header in use: From 6713362702ddbd11fff377426c347450255e5c2a Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 13 Aug 2020 10:11:33 +1000 Subject: [PATCH 10/12] seeds.rb needs to set ignore_deny_list field on Email --- db/seeds.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/seeds.rb b/db/seeds.rb index 4dd75430a..7078b8443 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -57,6 +57,7 @@ email = acting_app.emails.create!( from_address_id: address1.id, + ignore_deny_list: true, data: <<~EMAIL From: foo@bar.com To: foo@example.com @@ -128,6 +129,7 @@ email = office_app.emails.create!( from_address_id: address1.id, + ignore_deny_list: false, data: <<~EMAIL From: foo@bar.com To: foo@example.com @@ -168,6 +170,7 @@ email = acting_app.emails.create!( from_address_id: address1.id, + ignore_deny_list: false, data: <<~EMAIL From: foo@bar.com To: foo@example.com @@ -194,6 +197,7 @@ email = key_app.emails.create!( from_address_id: from.id, + ignore_deny_list: false, data: "To: #{to.text}\nSubject: #{subject}\n\n#{body}\n" ) From e0d1d1980a81a24643fe500a027d6acce89207bd Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 13 Aug 2020 10:24:18 +1000 Subject: [PATCH 11/12] In the email detail view show when the email has "ignore deny list" set --- app/graphql/types/email.rb | 7 +++++++ app/models/delivery.rb | 1 + app/views/deliveries/show.html.haml | 2 ++ lib/api/deliveries/show.graphql | 1 + 4 files changed, 11 insertions(+) diff --git a/app/graphql/types/email.rb b/app/graphql/types/email.rb index 51088730c..254b36a8d 100644 --- a/app/graphql/types/email.rb +++ b/app/graphql/types/email.rb @@ -38,6 +38,9 @@ class Email < GraphQL::Schema::Object field :clicked, Boolean, null: false, description: "Whether this email was clicked" + field :ignore_deny_list, Boolean, + null: false, + description: "If true the delivery of this email ignores whether the destination address is in the deny list" field :delivery_events, [Types::DeliveryEvent], null: false, description: "A list of delivery events for this email" @@ -70,6 +73,10 @@ def clicked object.delivery_links.any?(&:clicked?) end + def ignore_deny_list + object.ignore_deny_list + end + def delivery_events object.postfix_log_lines end diff --git a/app/models/delivery.rb b/app/models/delivery.rb index 775dac2d8..b9dfffad9 100644 --- a/app/models/delivery.rb +++ b/app/models/delivery.rb @@ -12,6 +12,7 @@ class Delivery < ActiveRecord::Base delegate :from, :from_address, :from_domain, :text_part, :html_part, :data, :click_tracking_enabled?, :open_tracking_enabled?, :subject, + :ignore_deny_list, to: :email delegate :tracking_domain_info, to: :app diff --git a/app/views/deliveries/show.html.haml b/app/views/deliveries/show.html.haml index 53506a2c5..0ca184abc 100644 --- a/app/views/deliveries/show.html.haml +++ b/app/views/deliveries/show.html.haml @@ -2,6 +2,8 @@ %h1= @delivery.subject %p + - if @delivery.ignore_deny_list + %span.label.label-warning Ignore Deny List %span{class: label_class(@delivery.status)} = status_name(@delivery.status) - if @delivery.opened? diff --git a/lib/api/deliveries/show.graphql b/lib/api/deliveries/show.graphql index dbb837c6e..9aa8d581b 100644 --- a/lib/api/deliveries/show.graphql +++ b/lib/api/deliveries/show.graphql @@ -19,6 +19,7 @@ query($id: ID!) { } opened clicked + ignoreDenyList deliveryEvents { time dsn From 66a705f89c7c769f910d9cec0993d59e1983aca3 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Thu, 13 Aug 2020 10:33:20 +1000 Subject: [PATCH 12/12] Stop test from trying to send an actual email --- spec/lib/cuttlefish_smtp_server_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/lib/cuttlefish_smtp_server_spec.rb b/spec/lib/cuttlefish_smtp_server_spec.rb index 41afde0b2..105de8696 100644 --- a/spec/lib/cuttlefish_smtp_server_spec.rb +++ b/spec/lib/cuttlefish_smtp_server_spec.rb @@ -156,6 +156,7 @@ end it do + allow(EmailServices::Send).to receive(:call) connection.receive_recipient("") connection.receive_plain_auth(app.smtp_username, app.smtp_password) connection.current.data = data