mailboxer 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/notification.rb +2 -1
- data/db/migrate/20110912163911_add_notification_code.rb +13 -0
- data/lib/mailboxer/models/messageable.rb +2 -5
- data/mailboxer.gemspec +1 -1
- data/spec/dummy/config/initializers/mailboxer.rb +1 -2
- data/spec/dummy/db/migrate/20110912170902_add_notification_code.rb +13 -0
- data/spec/dummy/db/schema.rb +2 -1
- data/spec/integration/navigation_spec.rb +1 -1
- metadata +6 -4
data/app/models/notification.rb
CHANGED
@@ -21,11 +21,12 @@ class Notification < ActiveRecord::Base
|
|
21
21
|
|
22
22
|
class << self
|
23
23
|
#Sends a Notification to all the recipients
|
24
|
-
def notify_all(recipients,subject,body,obj = nil,sanitize_text = true)
|
24
|
+
def notify_all(recipients,subject,body,obj = nil,sanitize_text = true,notification_code=nil)
|
25
25
|
notification = Notification.new({:body => body, :subject => subject})
|
26
26
|
notification.recipients = recipients.is_a?(Array) ? recipients : [recipients]
|
27
27
|
notification.recipients = notification.recipients.uniq
|
28
28
|
notification.notified_object = obj if obj.present?
|
29
|
+
notification.notification_code = notification_code if notification_code.present?
|
29
30
|
return notification.deliver sanitize_text
|
30
31
|
end
|
31
32
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddNotificationCode < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
change_table :notifications do |t|
|
4
|
+
t.string :notification_code, :default => nil
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
change_table :notifications do |t|
|
10
|
+
t.remove :notification_code
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -41,11 +41,8 @@ module Mailboxer
|
|
41
41
|
end
|
42
42
|
|
43
43
|
#Sends a notification to the messageable
|
44
|
-
def notify(subject,body,obj = nil,sanitize_text=true)
|
45
|
-
|
46
|
-
notification.recipients = [self]
|
47
|
-
notification.notified_object = obj if obj.present?
|
48
|
-
return notification.deliver sanitize_text
|
44
|
+
def notify(subject,body,obj = nil,sanitize_text=true,notification_code=nil)
|
45
|
+
return Notification.notify_all([self],subject,body,obj,sanitize_text,notification_code)
|
49
46
|
end
|
50
47
|
|
51
48
|
#Sends a messages, starting a new conversation, with the messageable
|
data/mailboxer.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "mailboxer"
|
3
|
-
s.version = "0.5.
|
3
|
+
s.version = "0.5.4"
|
4
4
|
s.authors = ["Eduardo Casanova Cuesta"]
|
5
5
|
s.summary = "Messaging system for rails apps."
|
6
6
|
s.description = "A Rails engine that allows any model to act as messageable, allowing it to exchange messages " +
|
@@ -7,7 +7,6 @@ Mailboxer.setup do |config|
|
|
7
7
|
config.default_from = "no-reply@mailboxer.com"
|
8
8
|
|
9
9
|
#Configures the methods needed by mailboxer
|
10
|
-
#config.email_method = :
|
10
|
+
#config.email_method = :mailboxer_email
|
11
11
|
#config.name_method = :name
|
12
|
-
#config.should_email_method = :should_email?
|
13
12
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddNotificationCode < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
change_table :notifications do |t|
|
4
|
+
t.string :notification_code, :default => nil
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
change_table :notifications do |t|
|
10
|
+
t.remove :notification_code
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended to check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(:version =>
|
13
|
+
ActiveRecord::Schema.define(:version => 20110912170902) do
|
14
14
|
|
15
15
|
create_table "conversations", :force => true do |t|
|
16
16
|
t.string "subject", :default => ""
|
@@ -44,6 +44,7 @@ ActiveRecord::Schema.define(:version => 20110719121059) do
|
|
44
44
|
t.datetime "created_at", :null => false
|
45
45
|
t.integer "notified_object_id"
|
46
46
|
t.string "notified_object_type"
|
47
|
+
t.string "notification_code"
|
47
48
|
end
|
48
49
|
|
49
50
|
add_index "notifications", ["conversation_id"], :name => "index_notifications_on_conversation_id"
|
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:
|
4
|
+
hash: 3
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 4
|
10
|
+
version: 0.5.4
|
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-09-
|
18
|
+
date: 2011-09-12 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- config/locales/en.yml
|
179
179
|
- db/migrate/20110511145103_create_mailboxer.rb
|
180
180
|
- db/migrate/20110719110700_add_notified_object.rb
|
181
|
+
- db/migrate/20110912163911_add_notification_code.rb
|
181
182
|
- lib/generators/mailboxer/install_generator.rb
|
182
183
|
- lib/generators/mailboxer/templates/initializer.rb
|
183
184
|
- lib/mailboxer.rb
|
@@ -213,6 +214,7 @@ files:
|
|
213
214
|
- spec/dummy/db/migrate/20110306015107_create_cylons.rb
|
214
215
|
- spec/dummy/db/migrate/20110719111119_create_mailboxer.rb
|
215
216
|
- spec/dummy/db/migrate/20110719121059_add_notified_object.rb
|
217
|
+
- spec/dummy/db/migrate/20110912170902_add_notification_code.rb
|
216
218
|
- spec/dummy/db/schema.rb
|
217
219
|
- spec/dummy/public/404.html
|
218
220
|
- spec/dummy/public/422.html
|