Commit 583bfac5f57d3d5c599c8d5d1c422e1bf7b9f265

Authored by Dmitriy Zaporozhets
1 parent 5ad4be29

Fix Note notification for entities without assignee

Showing 1 changed file with 4 additions and 1 deletions   Show diff stats
app/services/notification_service.rb
@@ -109,7 +109,10 @@ class NotificationService @@ -109,7 +109,10 @@ class NotificationService
109 recipients = [note.commit_author] 109 recipients = [note.commit_author]
110 else 110 else
111 opts.merge!(noteable_id: note.noteable_id) 111 opts.merge!(noteable_id: note.noteable_id)
112 - recipients = [note.noteable.try(:author), note.noteable.try(:assignee)] 112 + target = note.noteable
  113 + recipients = []
  114 + recipients << target.assignee if target.respond_to?(:assignee)
  115 + recipients << target.author if target.respond_to?(:author)
113 end 116 end
114 117
115 # Get users who left comment in thread 118 # Get users who left comment in thread