app/models/mailbox.rb in mailboxer-0.5.0 vs app/models/mailbox.rb in mailboxer-0.5.1

- old
+ new

@@ -7,11 +7,15 @@ end #Returns the notifications for the messageable def notifications(options = {}) #:type => nil is a hack not to give Messages as Notifications - return Notification.recipient(@messageable).where(:type => nil).order("notifications.created_at DESC") + notifs = Notification.recipient(@messageable).where(:type => nil).order("notifications.created_at DESC") + if (options[:read].present? and options[:read]==false) or (options[:unread].present? and options[:unread]==true) + notifs = notifs.unread + end + return notifs end #Returns the conversations for the messageable # #Options @@ -37,10 +41,10 @@ conv = Conversation.trash(@messageable) end end if (options[:read].present? and options[:read]==false) or (options[:unread].present? and options[:unread]==true) - conv = conv.unread(@messageable) + conv = conv.unread(@messageable) end return conv.uniq end