Browse Source
* Add mailer * Instantiate logs only where needed * Update banner to handle all possible permutations * wip * Send confirmation email to user * Address PO reviewpull/1711/head
Jack
2 years ago
committed by
GitHub
7 changed files with 248 additions and 121 deletions
@ -1,16 +1,8 @@
|
||||
<% if display_banner? %> |
||||
<%= govuk_notification_banner(title_text: "Important") do %> |
||||
<p class="govuk-notification-banner__heading govuk-!-width-full" style="max-width: fit-content"> |
||||
<%= I18n.t("validations.organisation.data_sharing_agreement_not_signed") %> |
||||
<%= header_text %> |
||||
<p> |
||||
<% if user.is_dpo? %> |
||||
<%= govuk_link_to( |
||||
"Read the Data Sharing Agreement", |
||||
data_sharing_agreement_href, |
||||
class: "govuk-notification-banner__link govuk-!-font-weight-bold", |
||||
) %> |
||||
<% else %> |
||||
<%= data_protection_officers_text %> |
||||
<% end %> |
||||
<%= banner_text %> |
||||
<% end %> |
||||
<% end %> |
||||
|
@ -0,0 +1,15 @@
|
||||
class DataProtectionConfirmationMailer < NotifyMailer |
||||
include Rails.application.routes.url_helpers |
||||
EMAIL_TEMPLATE_ID = "3dbf78fe-a2c8-4d65-aa19-e4d62695d4a9".freeze |
||||
|
||||
def send_confirmation_email(user) |
||||
send_email( |
||||
user.email, |
||||
EMAIL_TEMPLATE_ID, |
||||
{ |
||||
organisation_name: user.organisation.name, |
||||
link: data_sharing_agreement_organisation_url(user.organisation), |
||||
}, |
||||
) |
||||
end |
||||
end |
@ -0,0 +1,27 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe DataProtectionConfirmationMailer do |
||||
describe "#send_csv_download_mail" do |
||||
let(:notify_client) { instance_double(Notifications::Client) } |
||||
let(:user) { create(:user, email: "user@example.com") } |
||||
let(:organisation) { user.organisation } |
||||
|
||||
before do |
||||
allow(Notifications::Client).to receive(:new).and_return(notify_client) |
||||
allow(notify_client).to receive(:send_email).and_return(true) |
||||
end |
||||
|
||||
it "sends confirmation email to user" do |
||||
expect(notify_client).to receive(:send_email).with( |
||||
email_address: user.email, |
||||
template_id: "3dbf78fe-a2c8-4d65-aa19-e4d62695d4a9", |
||||
personalisation: { |
||||
organisation_name: organisation.name, |
||||
link: "#{ENV['APP_HOST']}/organisations/#{organisation.id}/data-sharing-agreement", |
||||
}, |
||||
) |
||||
|
||||
described_class.new.send_confirmation_email(user) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue