From 94d0b15aca4282d4edba8bca3902e88478803521 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 30 Dec 2015 18:26:28 +0800 Subject: [PATCH 1/2] Fix email reply with a note. SentNotification need use `record_note` method to save right noteable --- app/mailers/emails/notes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 65f37e92677c5..e1382d2da12e1 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -48,7 +48,7 @@ def note_mail_with_notification(note_id, recipient_id) yield - SentNotification.record(@note, recipient_id, reply_key) + SentNotification.record_note(@note, recipient_id, reply_key) end end end From 99f3dc50cea61b80353fbc1083b5543e521f598a Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 31 Dec 2015 11:14:19 +0800 Subject: [PATCH 2/2] Add test case for make sure SentNotification save a correct noteable value; --- spec/services/notification_service_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index d7a898e85ff6f..e0af2bbe3c038 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -52,6 +52,9 @@ it do add_users_with_subscription(note.project, issue) + # Ensure create SentNotification by noteable = issue 6 times, not noteable = note + expect(SentNotification).to receive(:record).with(issue, any_args).exactly(6).times + ActionMailer::Base.deliveries.clear notification.new_note(note)