rails-engine / notifications

🛎 Notifications Center engine like GitHub or other application for any Rails applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I exclude notification.actor from recieveing notifications?

opened this issue · comments

Hello! I'm creating notifications for a whenever a book review is submitted like so..

   after_commit :create_notifications, on: :create

    def create_notifications
        Notification.create do |notification|
            notification.notify_type = 'new_review'
            notification.actor = self.user
            notification.user = self.book.user
            notification.target = self
            notification.second_target = self.book
        end
    end

Things work fine but the notification.actor also gets notified. How do I exclude the actor? Thanks!

Hi! I'm creating a notification for whenever a book review is created like so in my review model which belongs_to :book

after_commit :create_notifications, on: :create

def create_notifications
Notification.create do |notification|
notification.notify_type = 'new_review'
notification.actor = self.user
notification.user = self.book.user
notification.target = self
notification.second_target = self.book
end
end
Things work fine but the notification.actor also gets notified. How do I exclude the actor from being notified whenever he submits a review on his book? Thanks!