From f4ad0b2979e7326454a4da419c81876934f8772a Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 26 Jan 2018 00:33:07 +0100 Subject: [PATCH] Improve add_notification logic to add notificable author --- app/controllers/comments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 5461566ee..854bb1c61 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -79,7 +79,7 @@ class CommentsController < ApplicationController def add_notification(comment) notifiable = comment.reply? ? comment.parent : comment.commentable - unless comment.author_id == notifiable.author_id + if notifiable&.author_id.present? && notifiable.author_id != comment.author_id Notification.add(notifiable.author_id, notifiable) end end