Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Rollbar error #569 undefined method name for nil:NilClass in admin sponsor page #2114

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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