mailboxer 0.11.0 → 0.12.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +4 -3
- data/Appraisals +6 -14
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/app/mailers/mailboxer/base_mailer.rb +14 -0
- data/app/mailers/{message_mailer.rb → mailboxer/message_mailer.rb} +9 -14
- data/app/mailers/mailboxer/notification_mailer.rb +17 -0
- data/app/models/mailboxer/conversation.rb +196 -0
- data/app/models/mailboxer/conversation/opt_out.rb +15 -0
- data/app/models/{mailbox.rb → mailboxer/mailbox.rb} +10 -10
- data/app/models/mailboxer/message.rb +49 -0
- data/app/models/{notification.rb → mailboxer/notification.rb} +44 -40
- data/app/models/{receipt.rb → mailboxer/receipt.rb} +12 -11
- data/app/views/{message_mailer → mailboxer/message_mailer}/new_message_email.html.erb +3 -3
- data/app/views/{message_mailer → mailboxer/message_mailer}/new_message_email.text.erb +2 -2
- data/app/views/{message_mailer → mailboxer/message_mailer}/reply_message_email.html.erb +3 -3
- data/app/views/{message_mailer → mailboxer/message_mailer}/reply_message_email.text.erb +2 -2
- data/app/views/{notification_mailer → mailboxer/notification_mailer}/new_notification_email.html.erb +0 -0
- data/app/views/{notification_mailer → mailboxer/notification_mailer}/new_notification_email.text.erb +0 -0
- data/db/migrate/20110511145103_create_mailboxer.rb +18 -14
- data/db/migrate/20131206080416_add_conversation_optout.rb +14 -0
- data/gemfiles/rails3.2.gemfile +2 -3
- data/gemfiles/rails4.0.gemfile +3 -4
- data/gemfiles/rails4.1.gemfile +7 -0
- data/lib/generators/mailboxer/install_generator.rb +1 -4
- data/lib/generators/mailboxer/namespacing_compatibility_generator.rb +22 -0
- data/lib/generators/mailboxer/templates/initializer.rb +8 -4
- data/lib/generators/mailboxer/templates/mailboxer_namespacing_compatibility.rb +24 -0
- data/lib/mailboxer.rb +7 -1
- data/lib/mailboxer/cleaner.rb +9 -0
- data/lib/mailboxer/engine.rb +1 -1
- data/lib/mailboxer/mail_dispatcher.rb +48 -0
- data/lib/mailboxer/models/messageable.rb +21 -20
- data/lib/mailboxer/version.rb +3 -0
- data/mailboxer.gemspec +16 -8
- data/spec/dummy/Gemfile +1 -1
- data/spec/dummy/app/models/duck.rb +2 -2
- data/spec/dummy/config/initializers/mailboxer.rb +4 -0
- data/spec/dummy/db/migrate/20120305103200_create_mailboxer.rb +18 -14
- data/spec/dummy/db/migrate/20131206080416_add_conversation_optout.rb +14 -0
- data/spec/dummy/db/schema.rb +30 -21
- data/spec/integration/message_and_receipt_spec.rb +212 -212
- data/spec/mailboxer/mail_dispatcher_spec.rb +114 -0
- data/spec/mailers/message_mailer_spec.rb +4 -4
- data/spec/mailers/notification_mailer_spec.rb +2 -2
- data/spec/models/conversation_spec.rb +148 -47
- data/spec/models/mailbox_spec.rb +50 -50
- data/spec/models/mailboxer_models_messageable_spec.rb +52 -52
- data/spec/models/message_spec.rb +1 -1
- data/spec/models/notification_spec.rb +50 -18
- data/spec/models/receipt_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- metadata +68 -57
- data/app/mailers/notification_mailer.rb +0 -21
- data/app/models/conversation.rb +0 -166
- data/app/models/message.rb +0 -68
- data/db/migrate/20110719110700_add_notified_object.rb +0 -17
- data/db/migrate/20110912163911_add_notification_code.rb +0 -13
- data/db/migrate/20111204163911_add_attachments.rb +0 -9
- data/db/migrate/20120813110712_rename_receipts_read.rb +0 -9
- data/db/migrate/20130305144212_add_global_notification_support.rb +0 -9
- data/gemfiles/rails3.0.gemfile +0 -8
- data/gemfiles/rails3.1.gemfile +0 -8
- data/lib/mailboxer/concerns/configurable_mailer.rb +0 -13
- data/spec/dummy/db/migrate/20120305103201_add_notified_object.rb +0 -17
- data/spec/dummy/db/migrate/20120305103202_add_notification_code.rb +0 -13
- data/spec/dummy/db/migrate/20120305103203_add_attachments.rb +0 -5
- data/spec/dummy/db/migrate/20120813110712_rename_receipts_read.rb +0 -9
- data/spec/dummy/db/migrate/20130305144212_add_global_notification_support.rb +0 -11
- data/spec/mailboxer/concerns/configurable_mailer_spec.rb +0 -27
@@ -1,40 +1,42 @@
|
|
1
|
-
class Notification < ActiveRecord::Base
|
1
|
+
class Mailboxer::Notification < ActiveRecord::Base
|
2
|
+
self.table_name = :mailboxer_notifications
|
3
|
+
|
2
4
|
attr_accessor :recipients
|
3
5
|
attr_accessible :body, :subject, :global, :expires if Mailboxer.protected_attributes?
|
4
6
|
|
5
7
|
belongs_to :sender, :polymorphic => :true
|
6
8
|
belongs_to :notified_object, :polymorphic => :true
|
7
|
-
has_many :receipts, :dependent => :destroy
|
9
|
+
has_many :receipts, :dependent => :destroy, :class_name => "Mailboxer::Receipt"
|
8
10
|
|
9
|
-
|
11
|
+
validates :subject, :presence => true,
|
12
|
+
:length => { :maximum => Mailboxer.subject_max_length }
|
13
|
+
validates :body, :presence => true,
|
14
|
+
:length => { :maximum => Mailboxer.body_max_length }
|
10
15
|
|
11
16
|
scope :recipient, lambda { |recipient|
|
12
|
-
joins(:receipts).where('
|
17
|
+
joins(:receipts).where('mailboxer_receipts.receiver_id' => recipient.id,'mailboxer_receipts.receiver_type' => recipient.class.base_class.to_s)
|
13
18
|
}
|
14
19
|
scope :with_object, lambda { |obj|
|
15
20
|
where('notified_object_id' => obj.id,'notified_object_type' => obj.class.to_s)
|
16
21
|
}
|
17
22
|
scope :not_trashed, lambda {
|
18
|
-
joins(:receipts).where('
|
23
|
+
joins(:receipts).where('mailboxer_receipts.trashed' => false)
|
19
24
|
}
|
20
25
|
scope :unread, lambda {
|
21
|
-
joins(:receipts).where('
|
26
|
+
joins(:receipts).where('mailboxer_receipts.is_read' => false)
|
22
27
|
}
|
23
28
|
scope :global, lambda { where(:global => true) }
|
24
|
-
scope :expired, lambda { where("
|
29
|
+
scope :expired, lambda { where("mailboxer_notifications.expires < ?", Time.now) }
|
25
30
|
scope :unexpired, lambda {
|
26
|
-
where("
|
31
|
+
where("mailboxer_notifications.expires is NULL OR mailboxer_notifications.expires > ?", Time.now)
|
27
32
|
}
|
28
33
|
|
29
|
-
include Concerns::ConfigurableMailer
|
30
|
-
|
31
34
|
class << self
|
32
35
|
#Sends a Notification to all the recipients
|
33
36
|
def notify_all(recipients,subject,body,obj = nil,sanitize_text = true,notification_code=nil,send_mail=true)
|
34
|
-
notification = Notification.new({:body => body, :subject => subject})
|
35
|
-
notification.recipients
|
36
|
-
notification.
|
37
|
-
notification.notified_object = obj if obj.present?
|
37
|
+
notification = Mailboxer::Notification.new({:body => body, :subject => subject})
|
38
|
+
notification.recipients = Array(recipients).uniq
|
39
|
+
notification.notified_object = obj if obj.present?
|
38
40
|
notification.notification_code = notification_code if notification_code.present?
|
39
41
|
notification.deliver sanitize_text, send_mail
|
40
42
|
end
|
@@ -43,7 +45,7 @@ class Notification < ActiveRecord::Base
|
|
43
45
|
#successful or +false+ if some error raised
|
44
46
|
def successful_delivery? receipts
|
45
47
|
case receipts
|
46
|
-
when Receipt
|
48
|
+
when Mailboxer::Receipt
|
47
49
|
receipts.valid?
|
48
50
|
receipts.errors.empty?
|
49
51
|
when Array
|
@@ -75,30 +77,20 @@ class Notification < ActiveRecord::Base
|
|
75
77
|
#Delivers a Notification. USE NOT RECOMENDED.
|
76
78
|
#Use Mailboxer::Models::Message.notify and Notification.notify_all instead.
|
77
79
|
def deliver(should_clean = true, send_mail = true)
|
78
|
-
|
80
|
+
clean if should_clean
|
79
81
|
temp_receipts = Array.new
|
82
|
+
|
80
83
|
#Receiver receipts
|
81
84
|
self.recipients.each do |r|
|
82
|
-
|
83
|
-
msg_receipt.notification = self
|
84
|
-
msg_receipt.is_read = false
|
85
|
-
msg_receipt.receiver = r
|
86
|
-
temp_receipts << msg_receipt
|
85
|
+
temp_receipts << build_receipt(r, nil, false)
|
87
86
|
end
|
88
|
-
|
89
|
-
if temp_receipts.all?
|
87
|
+
|
88
|
+
if temp_receipts.all?(&:valid?)
|
90
89
|
temp_receipts.each(&:save!) #Save receipts
|
91
|
-
self
|
92
|
-
|
93
|
-
if Mailboxer.uses_emails
|
94
|
-
email_to = r.send(Mailboxer.email_method,self)
|
95
|
-
if send_mail && !email_to.blank?
|
96
|
-
get_mailer.send_email(self,r).deliver
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
self.recipients=nil
|
90
|
+
Mailboxer::MailDispatcher.new(self, recipients).call if send_mail
|
91
|
+
self.recipients = nil
|
101
92
|
end
|
93
|
+
|
102
94
|
return temp_receipts if temp_receipts.size > 1
|
103
95
|
temp_receipts.first
|
104
96
|
end
|
@@ -119,7 +111,7 @@ class Notification < ActiveRecord::Base
|
|
119
111
|
|
120
112
|
#Returns the receipt for the participant
|
121
113
|
def receipt_for(participant)
|
122
|
-
Receipt.notification(self).recipient(participant)
|
114
|
+
Mailboxer::Receipt.notification(self).recipient(participant)
|
123
115
|
end
|
124
116
|
|
125
117
|
#Returns the receipt for the participant. Alias for receipt_for(participant)
|
@@ -179,14 +171,10 @@ class Notification < ActiveRecord::Base
|
|
179
171
|
return self.receipt_for(participant).mark_as_deleted
|
180
172
|
end
|
181
173
|
|
182
|
-
include ActionView::Helpers::SanitizeHelper
|
183
|
-
|
184
174
|
#Sanitizes the body and subject
|
185
175
|
def clean
|
186
|
-
|
187
|
-
|
188
|
-
end
|
189
|
-
self.body = sanitize self.body
|
176
|
+
self.subject = sanitize(subject) if subject
|
177
|
+
self.body = sanitize(body)
|
190
178
|
end
|
191
179
|
|
192
180
|
#Returns notified_object. DEPRECATED
|
@@ -194,4 +182,20 @@ class Notification < ActiveRecord::Base
|
|
194
182
|
warn "DEPRECATION WARNING: use 'notify_object' instead of 'object' to get the object associated with the Notification"
|
195
183
|
notified_object
|
196
184
|
end
|
185
|
+
|
186
|
+
def sanitize(text)
|
187
|
+
::Mailboxer::Cleaner.instance.sanitize(text)
|
188
|
+
end
|
189
|
+
|
190
|
+
private
|
191
|
+
|
192
|
+
def build_receipt(receiver, mailbox_type, is_read = false)
|
193
|
+
Mailboxer::Receipt.new.tap do |receipt|
|
194
|
+
receipt.notification = self
|
195
|
+
receipt.is_read = is_read
|
196
|
+
receipt.receiver = receiver
|
197
|
+
receipt.mailbox_type = mailbox_type
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
197
201
|
end
|
@@ -1,9 +1,10 @@
|
|
1
|
-
class Receipt < ActiveRecord::Base
|
1
|
+
class Mailboxer::Receipt < ActiveRecord::Base
|
2
|
+
self.table_name = :mailboxer_receipts
|
2
3
|
attr_accessible :trashed, :is_read, :deleted if Mailboxer.protected_attributes?
|
3
4
|
|
4
|
-
belongs_to :notification, :validate => true, :autosave => true
|
5
|
+
belongs_to :notification, :class_name => "Mailboxer::Notification", :validate => true, :autosave => true
|
5
6
|
belongs_to :receiver, :polymorphic => :true
|
6
|
-
belongs_to :message, :foreign_key => "notification_id"
|
7
|
+
belongs_to :message, :class_name => "Mailboxer::Message", :foreign_key => "notification_id"
|
7
8
|
|
8
9
|
validates_presence_of :receiver
|
9
10
|
|
@@ -12,13 +13,13 @@ class Receipt < ActiveRecord::Base
|
|
12
13
|
}
|
13
14
|
#Notifications Scope checks type to be nil, not Notification because of STI behaviour
|
14
15
|
#with the primary class (no type is saved)
|
15
|
-
scope :notifications_receipts, lambda { joins(:notification).where('
|
16
|
-
scope :messages_receipts, lambda { joins(:notification).where('
|
16
|
+
scope :notifications_receipts, lambda { joins(:notification).where('mailboxer_notifications.type' => nil) }
|
17
|
+
scope :messages_receipts, lambda { joins(:notification).where('mailboxer_notifications.type' => Mailboxer::Message.to_s) }
|
17
18
|
scope :notification, lambda { |notification|
|
18
19
|
where(:notification_id => notification.id)
|
19
20
|
}
|
20
21
|
scope :conversation, lambda { |conversation|
|
21
|
-
joins(:message).where('
|
22
|
+
joins(:message).where('mailboxer_notifications.conversation_id' => conversation.id)
|
22
23
|
}
|
23
24
|
scope :sentbox, lambda { where(:mailbox_type => "sentbox") }
|
24
25
|
scope :inbox, lambda { where(:mailbox_type => "inbox") }
|
@@ -86,7 +87,7 @@ class Receipt < ActiveRecord::Base
|
|
86
87
|
condition << "OR id = ? "
|
87
88
|
end
|
88
89
|
conditions[0] = condition
|
89
|
-
Receipt.except(:where).except(:joins).where(conditions).update_all(updates)
|
90
|
+
Mailboxer::Receipt.except(:where).except(:joins).where(conditions).update_all(updates)
|
90
91
|
end
|
91
92
|
end
|
92
93
|
end
|
@@ -134,7 +135,7 @@ class Receipt < ActiveRecord::Base
|
|
134
135
|
|
135
136
|
#Returns the conversation associated to the receipt if the notification is a Message
|
136
137
|
def conversation
|
137
|
-
message.conversation if message.is_a? Message
|
138
|
+
message.conversation if message.is_a? Mailboxer::Message
|
138
139
|
end
|
139
140
|
|
140
141
|
#Returns if the participant have read the Notification
|
@@ -152,9 +153,9 @@ class Receipt < ActiveRecord::Base
|
|
152
153
|
#Removes the duplicate error about not present subject from Conversation if it has been already
|
153
154
|
#raised by Message
|
154
155
|
def remove_duplicate_errors
|
155
|
-
if self.errors["
|
156
|
-
self.errors["
|
157
|
-
self.errors["
|
156
|
+
if self.errors["mailboxer_notification.conversation.subject"].present? and self.errors["mailboxer_notification.subject"].present?
|
157
|
+
self.errors["mailboxer_notification.conversation.subject"].each do |msg|
|
158
|
+
self.errors["mailboxer_notification.conversation.subject"].delete(msg)
|
158
159
|
end
|
159
160
|
end
|
160
161
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
5
5
|
</head>
|
6
6
|
<body>
|
7
|
-
<h1>You have a new message: <%= @
|
7
|
+
<h1>You have a new message: <%= @subject %></h1>
|
8
8
|
<p>
|
9
9
|
You have received a new message:
|
10
10
|
</p>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
</p>
|
15
15
|
</blockquote>
|
16
16
|
<p>
|
17
|
-
Visit <%= link_to root_url,root_url %> and go to your inbox for more info.
|
17
|
+
Visit <%= link_to root_url, root_url %> and go to your inbox for more info.
|
18
18
|
</p>
|
19
19
|
</body>
|
20
|
-
</html>
|
20
|
+
</html>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
You have a new message: <%= @
|
1
|
+
You have a new message: <%= @subject %>
|
2
2
|
===============================================
|
3
|
-
|
3
|
+
|
4
4
|
You have received a new message:
|
5
5
|
|
6
6
|
-----------------------------------------------
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
5
5
|
</head>
|
6
6
|
<body>
|
7
|
-
<h1>You have a new reply: <%= @
|
7
|
+
<h1>You have a new reply: <%= @subject %></h1>
|
8
8
|
<p>
|
9
9
|
You have received a new reply:
|
10
10
|
</p>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
</p>
|
15
15
|
</blockquote>
|
16
16
|
<p>
|
17
|
-
Visit <%= link_to root_url,root_url %> and go to your inbox for more info.
|
17
|
+
Visit <%= link_to root_url, root_url %> and go to your inbox for more info.
|
18
18
|
</p>
|
19
19
|
</body>
|
20
|
-
</html>
|
20
|
+
</html>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
You have a new reply: <%= @
|
1
|
+
You have a new reply: <%= @subject %>
|
2
2
|
===============================================
|
3
|
-
|
3
|
+
|
4
4
|
You have received a new reply:
|
5
5
|
|
6
6
|
-----------------------------------------------
|
data/app/views/{notification_mailer → mailboxer/notification_mailer}/new_notification_email.html.erb
RENAMED
File without changes
|
data/app/views/{notification_mailer → mailboxer/notification_mailer}/new_notification_email.text.erb
RENAMED
File without changes
|
@@ -2,16 +2,16 @@ class CreateMailboxer < ActiveRecord::Migration
|
|
2
2
|
def self.up
|
3
3
|
#Tables
|
4
4
|
#Conversations
|
5
|
-
create_table :
|
5
|
+
create_table :mailboxer_conversations do |t|
|
6
6
|
t.column :subject, :string, :default => ""
|
7
7
|
t.column :created_at, :datetime, :null => false
|
8
8
|
t.column :updated_at, :datetime, :null => false
|
9
9
|
end
|
10
10
|
#Receipts
|
11
|
-
create_table :
|
11
|
+
create_table :mailboxer_receipts do |t|
|
12
12
|
t.references :receiver, :polymorphic => true
|
13
13
|
t.column :notification_id, :integer, :null => false
|
14
|
-
t.column :
|
14
|
+
t.column :is_read, :boolean, :default => false
|
15
15
|
t.column :trashed, :boolean, :default => false
|
16
16
|
t.column :deleted, :boolean, :default => false
|
17
17
|
t.column :mailbox_type, :string, :limit => 25
|
@@ -19,43 +19,47 @@ class CreateMailboxer < ActiveRecord::Migration
|
|
19
19
|
t.column :updated_at, :datetime, :null => false
|
20
20
|
end
|
21
21
|
#Notifications and Messages
|
22
|
-
create_table :
|
22
|
+
create_table :mailboxer_notifications do |t|
|
23
23
|
t.column :type, :string
|
24
24
|
t.column :body, :text
|
25
25
|
t.column :subject, :string, :default => ""
|
26
26
|
t.references :sender, :polymorphic => true
|
27
|
-
t.references :object, :polymorphic => true
|
28
27
|
t.column :conversation_id, :integer
|
29
28
|
t.column :draft, :boolean, :default => false
|
29
|
+
t.string :notification_code, :default => nil
|
30
|
+
t.references :notified_object, :polymorphic => true
|
31
|
+
t.column :attachment, :string
|
30
32
|
t.column :updated_at, :datetime, :null => false
|
31
33
|
t.column :created_at, :datetime, :null => false
|
34
|
+
t.boolean :global, default: false
|
35
|
+
t.datetime :expires
|
32
36
|
end
|
33
37
|
|
34
38
|
|
35
39
|
#Indexes
|
36
40
|
#Conversations
|
37
41
|
#Receipts
|
38
|
-
add_index "
|
42
|
+
add_index "mailboxer_receipts","notification_id"
|
39
43
|
|
40
44
|
#Messages
|
41
|
-
add_index "
|
45
|
+
add_index "mailboxer_notifications","conversation_id"
|
42
46
|
|
43
47
|
#Foreign keys
|
44
48
|
#Conversations
|
45
49
|
#Receipts
|
46
|
-
add_foreign_key "
|
50
|
+
add_foreign_key "mailboxer_receipts", "mailboxer_notifications", :name => "receipts_on_notification_id", :column => "notification_id"
|
47
51
|
#Messages
|
48
|
-
add_foreign_key "
|
52
|
+
add_foreign_key "mailboxer_notifications", "mailboxer_conversations", :name => "notifications_on_conversation_id", :column => "conversation_id"
|
49
53
|
end
|
50
54
|
|
51
55
|
def self.down
|
52
56
|
#Tables
|
53
|
-
remove_foreign_key "
|
54
|
-
remove_foreign_key "
|
57
|
+
remove_foreign_key "mailboxer_receipts", :name => "receipts_on_notification_id"
|
58
|
+
remove_foreign_key "mailboxer_notifications", :name => "notifications_on_conversation_id"
|
55
59
|
|
56
60
|
#Indexes
|
57
|
-
drop_table :
|
58
|
-
drop_table :
|
59
|
-
drop_table :
|
61
|
+
drop_table :mailboxer_receipts
|
62
|
+
drop_table :mailboxer_conversations
|
63
|
+
drop_table :mailboxer_notifications
|
60
64
|
end
|
61
65
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddConversationOptout < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :mailboxer_conversation_opt_outs do |t|
|
4
|
+
t.references :unsubscriber, :polymorphic => true
|
5
|
+
t.references :conversation
|
6
|
+
end
|
7
|
+
add_foreign_key "mailboxer_conversation_opt_outs", "mailboxer_conversations", :name => "mb_opt_outs_on_conversations_id", :column => "conversation_id"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
remove_foreign_key "mailboxer_conversation_opt_outs", :name => "mb_opt_outs_on_conversations_id"
|
12
|
+
drop_table :mailboxer_conversation_opt_outs
|
13
|
+
end
|
14
|
+
end
|
data/gemfiles/rails3.2.gemfile
CHANGED
data/gemfiles/rails4.0.gemfile
CHANGED
@@ -18,10 +18,7 @@ class Mailboxer::InstallGenerator < Rails::Generators::Base #:nodoc:
|
|
18
18
|
|
19
19
|
def copy_migrations
|
20
20
|
if Rails.version < "3.1"
|
21
|
-
migrations = [["20110511145103_create_mailboxer.rb","create_mailboxer.rb"],
|
22
|
-
["20110719110700_add_notified_object.rb","add_notified_object.rb"],
|
23
|
-
["20110912163911_add_notification_code.rb","add_notification_code.rb"],
|
24
|
-
["20111204163911_add_attachments.rb","add_attachments.rb"]]
|
21
|
+
migrations = [["20110511145103_create_mailboxer.rb","create_mailboxer.rb"], ["20131206080416_add_conversation_optout.rb","add_conversation_optout.rb"]],
|
25
22
|
migrations.each do |migration|
|
26
23
|
migration_template "../../../../db/migrate/" + migration[0], "db/migrate/" + migration[1]
|
27
24
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Mailboxer::NamespacingCompatibilityGenerator < Rails::Generators::Base
|
2
|
+
include Rails::Generators::Migration
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
require 'rails/generators/migration'
|
5
|
+
|
6
|
+
FILENAME = 'mailboxer_namespacing_compatibility.rb'
|
7
|
+
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
9
|
+
|
10
|
+
def create_model_file
|
11
|
+
migration_template FILENAME, "db/migrate/#{FILENAME}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.next_migration_number path
|
15
|
+
unless @prev_migration_nr
|
16
|
+
@prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
17
|
+
else
|
18
|
+
@prev_migration_nr += 1
|
19
|
+
end
|
20
|
+
@prev_migration_nr.to_s
|
21
|
+
end
|
22
|
+
end
|
@@ -1,17 +1,21 @@
|
|
1
1
|
Mailboxer.setup do |config|
|
2
2
|
|
3
|
-
#Configures if you
|
3
|
+
#Configures if you application uses or not email sending for Notifications and Messages
|
4
4
|
config.uses_emails = true
|
5
5
|
|
6
|
-
#Configures the default from for
|
6
|
+
#Configures the default from for emails sent for Messages and Notifications
|
7
7
|
config.default_from = "no-reply@mailboxer.com"
|
8
8
|
|
9
9
|
#Configures the methods needed by mailboxer
|
10
10
|
config.email_method = :mailboxer_email
|
11
11
|
config.name_method = :name
|
12
12
|
|
13
|
-
#Configures if you use or not a search engine and
|
14
|
-
#Supported
|
13
|
+
#Configures if you use or not a search engine and which one you are using
|
14
|
+
#Supported engines: [:solr,:sphinx]
|
15
15
|
config.search_enabled = false
|
16
16
|
config.search_engine = :solr
|
17
|
+
|
18
|
+
#Configures maximum length of the message subject and body
|
19
|
+
config.subject_max_length = 255
|
20
|
+
config.body_max_length = 32000
|
17
21
|
end
|