has_messages 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/README.rdoc +1 -1
- data/Rakefile +3 -3
- data/app/models/message.rb +7 -3
- data/app/models/message_recipient.rb +7 -3
- data/lib/has_messages.rb +4 -2
- metadata +5 -5
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -98,5 +98,5 @@ To run against a specific version of Rails:
|
|
98
98
|
== Dependencies
|
99
99
|
|
100
100
|
* Rails 2.1 or later
|
101
|
-
* plugins_plus[http://github.com/pluginaweek/plugins_plus]
|
102
101
|
* state_machine[http://github.com/pluginaweek/state_machine]
|
102
|
+
* plugins_plus[http://github.com/pluginaweek/plugins_plugins] (optional if app files are copied to your project tree)
|
data/Rakefile
CHANGED
@@ -5,15 +5,15 @@ require 'rake/contrib/sshpublisher'
|
|
5
5
|
|
6
6
|
spec = Gem::Specification.new do |s|
|
7
7
|
s.name = 'has_messages'
|
8
|
-
s.version = '0.1.
|
8
|
+
s.version = '0.1.3'
|
9
9
|
s.platform = Gem::Platform::RUBY
|
10
10
|
s.summary = 'Demonstrates a reference implementation for sending messages between users.'
|
11
11
|
|
12
|
-
s.files = FileList['{app,db,lib,test}/**/*']
|
12
|
+
s.files = FileList['{app,db,lib,test}/**/*'] + %w(CHANGELOG.rdoc init.rb LICENSE Rakefile README.rdoc) - FileList['test/app_root/{log,log/*,script,script/*}']
|
13
13
|
s.require_path = 'lib'
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.test_files = Dir['test/**/*_test.rb']
|
16
|
-
s.add_dependency 'state_machine', '>= 0.
|
16
|
+
s.add_dependency 'state_machine', '>= 0.3.0'
|
17
17
|
|
18
18
|
s.author = 'Aaron Pfeifer'
|
19
19
|
s.email = 'aaron@pluginaweek.org'
|
data/app/models/message.rb
CHANGED
@@ -70,14 +70,16 @@ class Message < ActiveRecord::Base
|
|
70
70
|
end
|
71
71
|
alias_method :bcc=, :bcc
|
72
72
|
|
73
|
-
# Forwards this message
|
73
|
+
# Forwards this message, including the original subject and body in the new
|
74
|
+
# message
|
74
75
|
def forward
|
75
76
|
message = self.class.new(:subject => subject, :body => body)
|
76
77
|
message.sender = sender
|
77
78
|
message
|
78
79
|
end
|
79
80
|
|
80
|
-
# Replies to this message
|
81
|
+
# Replies to this message, including the original subject and body in the new
|
82
|
+
# message. Only the original direct receivers are added to the reply.
|
81
83
|
def reply
|
82
84
|
message = self.class.new(:subject => subject, :body => body)
|
83
85
|
message.sender = sender
|
@@ -85,7 +87,9 @@ class Message < ActiveRecord::Base
|
|
85
87
|
message
|
86
88
|
end
|
87
89
|
|
88
|
-
# Replies to all recipients on this message
|
90
|
+
# Replies to all recipients on this message, including the original subject
|
91
|
+
# and body in the new message. All receivers (direct, cc, and bcc) are added
|
92
|
+
# to the reply.
|
89
93
|
def reply_to_all
|
90
94
|
message = reply
|
91
95
|
message.cc(cc)
|
@@ -55,14 +55,16 @@ class MessageRecipient < ActiveRecord::Base
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
# Forwards the
|
58
|
+
# Forwards this message, including the original subject and body in the new
|
59
|
+
# message
|
59
60
|
def forward
|
60
61
|
message = self.message.class.new(:subject => subject, :body => body)
|
61
62
|
message.sender = receiver
|
62
63
|
message
|
63
64
|
end
|
64
65
|
|
65
|
-
# Replies to the
|
66
|
+
# Replies to this message, including the original subject and body in the new
|
67
|
+
# message. Only the original direct receivers are added to the reply.
|
66
68
|
def reply
|
67
69
|
message = self.message.class.new(:subject => subject, :body => body)
|
68
70
|
message.sender = receiver
|
@@ -70,7 +72,9 @@ class MessageRecipient < ActiveRecord::Base
|
|
70
72
|
message
|
71
73
|
end
|
72
74
|
|
73
|
-
# Replies to all recipients on
|
75
|
+
# Replies to all recipients on this message, including the original subject
|
76
|
+
# and body in the new message. All receivers (sender, direct, cc, and bcc) are
|
77
|
+
# added to the reply.
|
74
78
|
def reply_to_all
|
75
79
|
message = reply
|
76
80
|
message.to(to - [receiver] + [sender])
|
data/lib/has_messages.rb
CHANGED
@@ -57,12 +57,14 @@ module PluginAWeek #:nodoc:
|
|
57
57
|
end
|
58
58
|
|
59
59
|
module InstanceMethods
|
60
|
-
# Composed messages that have not yet been sent
|
60
|
+
# Composed messages that have not yet been sent. These consists of all
|
61
|
+
# messages that are currently in the "unsent" state.
|
61
62
|
def unsent_messages
|
62
63
|
messages.with_state('unsent')
|
63
64
|
end
|
64
65
|
|
65
|
-
# Composed messages that have already been sent
|
66
|
+
# Composed messages that have already been sent. These consists of all
|
67
|
+
# messages that are currently in the "queued" or "sent" states.
|
66
68
|
def sent_messages
|
67
69
|
messages.with_states(%w(queued sent))
|
68
70
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_messages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Pfeifer
|
@@ -9,17 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-07 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: state_machine
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
23
|
+
version: 0.3.0
|
23
24
|
version:
|
24
25
|
description:
|
25
26
|
email: aaron@pluginaweek.org
|
@@ -47,7 +48,6 @@ files:
|
|
47
48
|
- test/app_root/db/migrate
|
48
49
|
- test/app_root/db/migrate/001_create_users.rb
|
49
50
|
- test/app_root/db/migrate/002_migrate_has_messages_to_version_2.rb
|
50
|
-
- test/app_root/log
|
51
51
|
- test/functional
|
52
52
|
- test/functional/has_messages_test.rb
|
53
53
|
- test/test_helper.rb
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
requirements: []
|
83
83
|
|
84
84
|
rubyforge_project: pluginaweek
|
85
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.2.0
|
86
86
|
signing_key:
|
87
87
|
specification_version: 2
|
88
88
|
summary: Demonstrates a reference implementation for sending messages between users.
|