Commit acd139d9 authored by Ash McKenzie's avatar Ash McKenzie

Cast object class to string to avoid infinite loop

parent e095507c
...@@ -857,7 +857,7 @@ class NotificationService ...@@ -857,7 +857,7 @@ class NotificationService
end end
def warn_skipping_notifications(user, object) def warn_skipping_notifications(user, object)
Gitlab::AppLogger.warn(message: "Skipping sending notifications", user: user.id, klass: object.class, object_id: object.id) Gitlab::AppLogger.warn(message: "Skipping sending notifications", user: user.id, klass: object.class.to_s, object_id: object.id)
end end
end end
......
...@@ -655,7 +655,7 @@ RSpec.describe EE::NotificationService, :mailer do ...@@ -655,7 +655,7 @@ RSpec.describe EE::NotificationService, :mailer do
shared_examples 'is not able to send notifications' do shared_examples 'is not able to send notifications' do
it 'does not send any notification' do it 'does not send any notification' do
expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: current_user.id, klass: epic.class, object_id: epic.id) expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: current_user.id, klass: epic.class.to_s, object_id: epic.id)
execute execute
......
...@@ -45,7 +45,7 @@ RSpec.describe NewEpicWorker do ...@@ -45,7 +45,7 @@ RSpec.describe NewEpicWorker do
it 'does not create a notification for the mentioned user' do it 'does not create a notification for the mentioned user' do
expect(Notify).not_to receive(:new_epic_email).with(user.id, epic.id, nil) expect(Notify).not_to receive(:new_epic_email).with(user.id, epic.id, nil)
expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: user.id, klass: epic.class, object_id: epic.id) expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: user.id, klass: epic.class.to_s, object_id: epic.id)
worker.perform(epic.id, user.id) worker.perform(epic.id, user.id)
end end
......
...@@ -105,7 +105,7 @@ RSpec.describe NotificationService, :mailer do ...@@ -105,7 +105,7 @@ RSpec.describe NotificationService, :mailer do
recipient_1 = NotificationRecipient.new(user_1, :custom, custom_action: :new_release) recipient_1 = NotificationRecipient.new(user_1, :custom, custom_action: :new_release)
allow(NotificationRecipients::BuildService).to receive(:build_new_release_recipients).and_return([recipient_1]) allow(NotificationRecipients::BuildService).to receive(:build_new_release_recipients).and_return([recipient_1])
expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: current_user.id, klass: object.class, object_id: object.id) expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: current_user.id, klass: object.class.to_s, object_id: object.id)
action action
......
...@@ -49,7 +49,7 @@ RSpec.describe NewIssueWorker do ...@@ -49,7 +49,7 @@ RSpec.describe NewIssueWorker do
expect(Notify).not_to receive(:new_issue_email) expect(Notify).not_to receive(:new_issue_email)
.with(mentioned.id, issue.id, NotificationReason::MENTIONED) .with(mentioned.id, issue.id, NotificationReason::MENTIONED)
expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: user.id, klass: issue.class, object_id: issue.id) expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: user.id, klass: issue.class.to_s, object_id: issue.id)
worker.perform(issue.id, user.id) worker.perform(issue.id, user.id)
end end
......
...@@ -53,7 +53,7 @@ RSpec.describe NewMergeRequestWorker do ...@@ -53,7 +53,7 @@ RSpec.describe NewMergeRequestWorker do
expect(Notify).not_to receive(:new_merge_request_email) expect(Notify).not_to receive(:new_merge_request_email)
.with(mentioned.id, merge_request.id, NotificationReason::MENTIONED) .with(mentioned.id, merge_request.id, NotificationReason::MENTIONED)
expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: user.id, klass: merge_request.class, object_id: merge_request.id) expect(Gitlab::AppLogger).to receive(:warn).with(message: 'Skipping sending notifications', user: user.id, klass: merge_request.class.to_s, object_id: merge_request.id)
worker.perform(merge_request.id, user.id) worker.perform(merge_request.id, user.id)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment