app/models/mailbox.rb in mailboxer-0.0.14 vs app/models/mailbox.rb in mailboxer-0.0.15

- old
+ new

@@ -2,10 +2,14 @@ attr_accessor :type attr_reader :messageable def initialize(recipient, box = :all) @messageable = recipient end + + def notifications(options = {}) + return Receipt.where(options).receiver(@messageable).notifications + end def conversations(options = {}) conv = Conversation.participant(@messageable) if options[:mailbox_type].present? @@ -20,11 +24,11 @@ end if (options[:read].present? and options[:read]==false) or (options[:unread].present? and options[:unread]==true) conv = conv.unread(@messageable) end - + return conv.uniq end def inbox(options={}) options = options.merge(:mailbox_type => 'inbox') @@ -44,9 +48,10 @@ def receipts(options = {}) return Receipt.where(options).receiver(@messageable) end def empty_trash(options = {}) + #TODO return false end def has_conversation?(conversation) return conversation.is_participant?(@messageable)