Skip to content

Commit

Permalink
Merge pull request #2114 from codebar/rollbar-569-undefined-method-na…
Browse files Browse the repository at this point in the history
…me-for-nil

Fix Rollbar error #569 undefined method name for nil:NilClass in admin sponsor page
  • Loading branch information
matyikriszta authored Sep 9, 2024
2 parents 8dec17e + b1e5f73 commit 0459aea
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
%li #{link_to(activity.owner.full_name, admin_member_path(activity.owner))} subscribed #{activity.recipient.name} #{activity.recipient.surname} with email #{activity.parameters[:note]} to the Sponsor newsletter
- if activity.recipient.present?
%li #{link_to(activity.owner.full_name, admin_member_path(activity.owner))} subscribed #{activity&.recipient.name} #{activity&.recipient.surname} with email #{activity.parameters[:note]} to the Sponsor newsletter
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
%li #{link_to(activity.owner.full_name, admin_member_path(activity.owner))} unsubscribed #{activity.recipient.name} #{activity.recipient.surname} with email #{activity.parameters[:note]} from the Sponsor newsletter
- if activity.recipient.present?
%li #{link_to(activity.owner.full_name, admin_member_path(activity.owner))} unsubscribed #{activity.recipient.name} #{activity.recipient.surname} with email #{activity.parameters[:note]} from the Sponsor newsletter
28 changes: 28 additions & 0 deletions spec/features/admin/sponsor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,34 @@
end
end
end

context 'activities' do
scenario 'when there are activities' do
contact = sponsor.contacts.first
audit = Auditor::Audit.new(sponsor, 'sponsor.admin_contact_subscribe', manager, contact)
audit.log_with_note(contact.email)

visit admin_sponsor_path(sponsor)

within '#activities' do
expect(page).to have_content("#{manager.full_name} subscribed #{contact.name} #{contact.surname} with email #{contact.email} to the Sponsor newsletter")
end
end

scenario 'when an activity is associated with a deleted contact' do
contact = sponsor.contacts.first
audit = Auditor::Audit.new(sponsor, 'sponsor.admin_contact_subscribe', manager, contact)
audit.log_with_note(contact.email)

contact.delete

visit admin_sponsor_path(sponsor)

within '#activities' do
expect(page).to_not have_content("#{manager.full_name} subscribed #{contact.name} #{contact.surname} with email #{contact.email} to the Sponsor newsletter")
end
end
end
end

context 'Editing a sponsor' do
Expand Down

0 comments on commit 0459aea

Please sign in to comment.