From ac9f85e2083cac6a4c35eaec3340c83a383f9e69 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 18 Apr 2018 16:23:19 +0200 Subject: [PATCH] Change Proposal Notification Digest link to anchor On the proposal notification digest messages there was a link to each notification. Instead we need that link to point towards the notifications tab of the proposal. --- app/views/mailer/proposal_notification_digest.html.erb | 2 +- spec/features/admin/system_emails_spec.rb | 10 ++++++---- spec/features/emails_spec.rb | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/views/mailer/proposal_notification_digest.html.erb b/app/views/mailer/proposal_notification_digest.html.erb index 1a0ef1468..8f80c3e0c 100644 --- a/app/views/mailer/proposal_notification_digest.html.erb +++ b/app/views/mailer/proposal_notification_digest.html.erb @@ -22,7 +22,7 @@

- <%= link_to notification.notifiable.title, notification_url(notification), style: "color: #2895F1; text-decoration: none;" %> + <%= link_to notification.notifiable.title, proposal_url(notification.notifiable.proposal, anchor: "tab-notifications"), style: "color: #2895F1; text-decoration: none;" %>

<%= notification.notifiable.proposal.title %> •  diff --git a/spec/features/admin/system_emails_spec.rb b/spec/features/admin/system_emails_spec.rb index 634a32efb..dd14e87bc 100644 --- a/spec/features/admin/system_emails_spec.rb +++ b/spec/features/admin/system_emails_spec.rb @@ -27,14 +27,16 @@ feature "System Emails" do proposal_notification_b = create(:proposal_notification, proposal: proposal_b, title: 'Proposal B Title', body: 'Proposal B Notification Body') - notification_a = create(:notification, notifiable: proposal_notification_a) - notification_b = create(:notification, notifiable: proposal_notification_b) + create(:notification, notifiable: proposal_notification_a) + create(:notification, notifiable: proposal_notification_b) visit admin_system_email_view_path('proposal_notification_digest') expect(page).to have_content('Proposal notifications in') - expect(page).to have_link('Proposal A Title', href: notification_url(notification_a)) - expect(page).to have_link('Proposal B Title', href: notification_url(notification_b)) + expect(page).to have_link('Proposal A Title', href: proposal_url(proposal_a, + anchor: 'tab-notifications')) + expect(page).to have_link('Proposal B Title', href: proposal_url(proposal_b, + anchor: 'tab-notifications')) expect(page).to have_content('Proposal A Notification Body') expect(page).to have_content('Proposal B Notification Body') end diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 4d009bfbc..91f8b31b6 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -306,14 +306,14 @@ feature 'Emails' do expect(email).to have_body_text(notification1.notifiable.body) expect(email).to have_body_text(proposal1.author.name) - expect(email).to have_body_text(/#{notification_path(notification1)}/) + expect(email).to have_body_text(/#{proposal_path(proposal1, anchor: 'tab-notifications')}/) expect(email).to have_body_text(/#{proposal_path(proposal1, anchor: 'comments')}/) expect(email).to have_body_text(/#{proposal_path(proposal1, anchor: 'social-share')}/) expect(email).to have_body_text(proposal2.title) expect(email).to have_body_text(notification2.notifiable.title) expect(email).to have_body_text(notification2.notifiable.body) - expect(email).to have_body_text(/#{notification_path(notification2)}/) + expect(email).to have_body_text(/#{proposal_path(proposal2, anchor: 'tab-notifications')}/) expect(email).to have_body_text(/#{proposal_path(proposal2, anchor: 'comments')}/) expect(email).to have_body_text(/#{proposal_path(proposal2, anchor: 'social-share')}/) expect(email).to have_body_text(proposal2.author.name)