Skip to content

Commit

Permalink
Show all email sending events
Browse files Browse the repository at this point in the history
Feedback on PR we want to show all admin email sending events on the
task, not just the latest one
  • Loading branch information
rjlynch committed Sep 12, 2024
1 parent c3c004c commit 734c022
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ def rows
end
end

def latest_admin_sent_email
claim.notes.by_label("provider_verification").order(created_at: :desc).first
def admin_sent_emails
@admin_sent_emails ||= claim.notes.by_label("provider_verification").order(created_at: :desc)
end

def verification_email_sent?
!claim.eligibility.flagged_as_duplicate? || verification_email_sent_by_admin_team?
end

def verification_email_sent_by_admin_team?
latest_admin_sent_email.present?
admin_sent_emails.any?
end

private
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<% if @tasks_presenter.provider_verification.verification_email_sent? %>
<% if @tasks_presenter.provider_verification.verification_email_sent_by_admin_team? %>
<% verification_email = @tasks_presenter.provider_verification.latest_admin_sent_email %>
<div class="govuk-inset-text">
<p>
The verification request was sent to the provider by
<%= user_details(verification_email.created_by) %> on <%= l(verification_email.created_at) %>
</p>
<% @tasks_presenter.provider_verification.admin_sent_emails.each do |verification_email| %>
<p>
The verification request was sent to the provider by
<%= user_details(verification_email.created_by) %> on <%= l(verification_email.created_at) %>
</p>
<% end %>
</div>
<% end %>

Expand Down

0 comments on commit 734c022

Please sign in to comment.