mailboxer 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -93,6 +93,21 @@ class Conversation < ActiveRecord::Base
93
93
  return false if participant.nil?
94
94
  return self.receipts(participant).count != 0
95
95
  end
96
+
97
+ def is_trashed?(participant)
98
+ return false if participant.nil?
99
+ return self.receipts(participant).trash.count!=0
100
+ end
101
+
102
+ def is_completely_trashed?(participant)
103
+ return false if participant.nil?
104
+ return self.receipts(participant).trash.count==self.receipts(participant).count
105
+ end
106
+
107
+ def is_unread?(participant)
108
+ return false if participant.nil?
109
+ return self.receipts(participant).unread.count!=0
110
+ end
96
111
  # protected
97
112
  # #[empty method]
98
113
  # #
@@ -75,14 +75,14 @@ class Mailbox
75
75
  end
76
76
 
77
77
  def has_conversation?(conversation)
78
- return self.receipts.conversation(converstaion).count!=0
78
+ return conversation.is_participant?(@messageable)
79
79
  end
80
80
 
81
81
  def is_trashed?(conversation)
82
- return self.receipts.trash.conversation(conversation).count!=0
82
+ return conversation.is_trashed?(@messageable)
83
83
  end
84
84
  def is_completely_trashed?(conversation)
85
- return self.receipts.trash.conversation(conversation).count==self.receipts.conversation(conversation).count
85
+ return conversation.is_completely_trashed?(@messageable)
86
86
  end
87
87
 
88
88
  end
@@ -34,7 +34,17 @@ class Message < ActiveRecord::Base
34
34
  recipients_array << receipt.receiver
35
35
  end
36
36
  return recipients_array.uniq
37
- end
37
+ end
38
+
39
+ def receipts(participant=nil)
40
+ return Receipt.message(self).receiver(participant) if participant
41
+ return Receipt.message(self)
42
+ end
43
+
44
+ def is_unread?(participant)
45
+ return false if participant.nil?
46
+ return self.receipts(participant).unread.count!=0
47
+ end
38
48
 
39
49
  include ActionView::Helpers::SanitizeHelper
40
50
  def clean
data/mailboxer.gemspec CHANGED
@@ -1,11 +1,11 @@
1
1
 
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "mailboxer"
4
- s.version = "0.0.11"
4
+ s.version = "0.0.12"
5
5
 
6
6
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
7
  s.authors = ["Eduardo Casanova Cuesta"]
8
- s.date = %q{2011-03-23}
8
+ s.date = %q{2011-03-26}
9
9
  s.description = %q{A Rails engine that allows any model to act as messageable, permitting it interchange messages with any other messageable model. }
10
10
  s.email = %q{ecasanovac@gmail.com}
11
11
  s.extra_rdoc_files = [
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.summary = %q{Messaging system for rails apps.}
20
20
  s.files = `git ls-files`.split("\n")
21
21
 
22
- s.add_dependency(%q<rails>, ["= 3.0.5"])
22
+ s.add_development_dependency('rails', '~> 3.0.5')
23
23
  s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
24
24
  if RUBY_VERSION < '1.9'
25
25
  s.add_development_dependency('ruby-debug', '~> 0.10.3')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailboxer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eduardo Casanova Cuesta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-23 00:00:00 +01:00
18
+ date: 2011-03-26 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,7 +24,7 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - "="
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  hash: 13
30
30
  segments:
@@ -32,7 +32,7 @@ dependencies:
32
32
  - 0
33
33
  - 5
34
34
  version: 3.0.5
35
- type: :runtime
35
+ type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: sqlite3-ruby