mail_form 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mail_form/delivery.rb +10 -1
- data/lib/mail_form/version.rb +1 -1
- data/test/mail_form_test.rb +7 -3
- data/test/resource_test.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6518ae2061974f6752fb23da63807e6977b0f3c
|
4
|
+
data.tar.gz: 8ed10502f0cc6ba1a2fb546ff2032f88be2dec72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6e331507e760518207fbf072d43a6dbadde4d3bff14cc9eac32e314d54772a737023ff2e3dba6b9b73bef350b8da9484a55828db2b1c12e750d79167543ee3d
|
7
|
+
data.tar.gz: 4746bdd0ab9f965af5a220ad6fa962ab501269bbbccdafdf8a20e0e781a4719f78230aa5e32a96952aecd277367b03e9c9da086c42cf9d0dfd2132b88c9f30dc
|
data/lib/mail_form/delivery.rb
CHANGED
@@ -15,7 +15,12 @@ module MailForm
|
|
15
15
|
class_attribute :mail_appendable
|
16
16
|
self.mail_appendable = []
|
17
17
|
|
18
|
-
|
18
|
+
# not_spam? simply returns false, but when used as a callback, we have to throw(:abort)
|
19
|
+
# to halt the callback chain, beginning with Rails 5.1.
|
20
|
+
if ActionPack.respond_to?(:version) && ActionPack.version >= Gem::Version.new('5.1')
|
21
|
+
before_deliver :check_not_spam
|
22
|
+
after_deliver :deliver!
|
23
|
+
elsif respond_to?(:before_deliver) && respond_to?(:after_deliver)
|
19
24
|
before_deliver :not_spam?
|
20
25
|
after_deliver :deliver!
|
21
26
|
else # For ActiveRecord compatibility
|
@@ -146,6 +151,10 @@ module MailForm
|
|
146
151
|
!spam?
|
147
152
|
end
|
148
153
|
|
154
|
+
def check_not_spam
|
155
|
+
throw(:abort) if spam?
|
156
|
+
end
|
157
|
+
|
149
158
|
# Deliver the resource without running any validation.
|
150
159
|
def deliver!
|
151
160
|
mailer = MailForm::Notifier.contact(self)
|
data/lib/mail_form/version.rb
CHANGED
data/test/mail_form_test.rb
CHANGED
@@ -7,9 +7,13 @@ class MailFormNotifierTest < ActiveSupport::TestCase
|
|
7
7
|
def setup
|
8
8
|
@form = ContactForm.new(:name => 'José', :email => 'my.email@my.domain.com', :message => 'Cool')
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
@request = if ActionPack.respond_to?(:version) && ActionPack.version >= Gem::Version.new('5.1')
|
11
|
+
ActionController::TestRequest.create(Class.new) # Rails 5.1
|
12
|
+
elsif ActionPack.respond_to?(:version) && ActionPack.version >= Gem::Version.new('5.0')
|
13
|
+
ActionController::TestRequest.create # Rails 5
|
14
|
+
else
|
15
|
+
ActionController::TestRequest.new
|
16
|
+
end
|
13
17
|
@valid_attributes = { :name => 'José', :email => 'my.email@my.domain.com', :message => "Cool\nno?" }
|
14
18
|
@advanced = AdvancedForm.new(@valid_attributes)
|
15
19
|
@advanced.request = @request
|
data/test/resource_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionmailer
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '3.2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '5.
|
23
|
+
version: '5.2'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '3.2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.2'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: activemodel
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: '3.2'
|
41
41
|
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '5.
|
43
|
+
version: '5.2'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
version: '3.2'
|
51
51
|
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '5.
|
53
|
+
version: '5.2'
|
54
54
|
description: Send e-mail straight from forms in Rails with I18n, validations, attachments
|
55
55
|
and request information.
|
56
56
|
email: contact@plataformatec.com.br
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project: mail_form
|
97
|
-
rubygems_version: 2.
|
97
|
+
rubygems_version: 2.6.10
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Send e-mail straight from forms in Rails with I18n, validations, attachments
|
@@ -105,4 +105,3 @@ test_files:
|
|
105
105
|
- test/test_file.txt
|
106
106
|
- test/test_helper.rb
|
107
107
|
- test/views/mail_form/custom_template.erb
|
108
|
-
has_rdoc:
|