From 583bfac5f57d3d5c599c8d5d1c422e1bf7b9f265 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 28 Mar 2013 16:00:19 +0200 Subject: [PATCH] Fix Note notification for entities without assignee --- app/services/notification_service.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index 3c3ee39c..486aef1d 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -109,7 +109,10 @@ class NotificationService recipients = [note.commit_author] else opts.merge!(noteable_id: note.noteable_id) - recipients = [note.noteable.try(:author), note.noteable.try(:assignee)] + target = note.noteable + recipients = [] + recipients << target.assignee if target.respond_to?(:assignee) + recipients << target.author if target.respond_to?(:author) end # Get users who left comment in thread