omit likes if notify likes is set to never

This commit is contained in:
Sam 2016-03-06 09:21:38 +11:00
parent af577a5854
commit 332e05b73d

View file

@ -122,12 +122,19 @@ class Notification < ActiveRecord::Base
end
def self.recent_report(user, count = nil)
return unless user && user.user_option
count ||= 10
notifications = user.notifications
.visible
.recent(count)
.includes(:topic)
.to_a
if user.user_option.like_notification_frequency == UserOption.like_notification_frequency_type[:never]
notifications = notifications.where('notification_type <> ?', Notification.types[:liked])
end
notifications = notifications.to_a
if notifications.present?