ahoy_email 2.3.1 → 2.5.0
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/CHANGELOG.md +22 -1
- data/README.md +12 -2
- data/app/controllers/ahoy/messages_controller.rb +1 -1
- data/lib/ahoy_email/engine.rb +1 -1
- data/lib/ahoy_email/mailer.rb +3 -0
- data/lib/ahoy_email/processor.rb +14 -1
- data/lib/ahoy_email/utils.rb +2 -2
- data/lib/ahoy_email/version.rb +1 -1
- data/lib/ahoy_email.rb +4 -1
- data/lib/generators/ahoy/messages/activerecord_generator.rb +13 -2
- metadata +6 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa1850e7d07ec2fe43003f8e6c2046a10bd8229c6e5e8d12849cc8a2d819f670
|
4
|
+
data.tar.gz: 4eefd3654e671eb6c65b064025d9ea5c7dd7810d73f12bbc8b34cafb2e5e00f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e021685e661cbb627a5d95fde8dfccbc0630398a391eea319d64ce268f3219918a6442a23f1ed9a2a06b69761a97f09aa8cb2a633e282affc200e4ac45b7d7b
|
7
|
+
data.tar.gz: 104b6dfebf8f9d3bb3381e09b972708f539122ff2ca062cfc0aaf5a5af529661e06c196dfa35e862a8709b2ede56af3dcf13af9ee1bb15552ce036323ced9f39
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 2.5.0 (2025-05-04)
|
2
|
+
|
3
|
+
- Removed support for Ruby < 3.2 and Rails < 7.1
|
4
|
+
|
5
|
+
## 2.4.0 (2024-11-11)
|
6
|
+
|
7
|
+
- Added `html5` option
|
8
|
+
- Improved generator for Active Record encryption and MySQL
|
9
|
+
- Removed support for Ruby < 3.1 and Rails < 7
|
10
|
+
- Removed support for Mongoid < 8
|
11
|
+
|
1
12
|
## 2.3.1 (2024-09-09)
|
2
13
|
|
3
14
|
- Fixed deprecation warning with Rails 7.1
|
@@ -180,4 +191,14 @@ Breaking changes
|
|
180
191
|
|
181
192
|
## 0.1.0 (2014-04-29)
|
182
193
|
|
183
|
-
-
|
194
|
+
- Changed option names
|
195
|
+
|
196
|
+
## 0.0.2 (2014-04-29)
|
197
|
+
|
198
|
+
- Added open and click tracking
|
199
|
+
- Added UTM parameters
|
200
|
+
- Rescue errors
|
201
|
+
|
202
|
+
## 0.0.1 (2014-04-28)
|
203
|
+
|
204
|
+
- First release
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ rails generate ahoy:messages --encryption=lockbox
|
|
33
33
|
rails db:migrate
|
34
34
|
```
|
35
35
|
|
36
|
-
To use Active Record encryption
|
36
|
+
To use Active Record encryption, run:
|
37
37
|
|
38
38
|
```sh
|
39
39
|
rails generate ahoy:messages --encryption=activerecord
|
@@ -106,7 +106,7 @@ user.messages
|
|
106
106
|
Add extra data to messages. Create a migration like:
|
107
107
|
|
108
108
|
```ruby
|
109
|
-
class AddCouponIdToAhoyMessages < ActiveRecord::Migration[
|
109
|
+
class AddCouponIdToAhoyMessages < ActiveRecord::Migration[8.0]
|
110
110
|
def change
|
111
111
|
add_column :ahoy_messages, :coupon_id, :integer
|
112
112
|
end
|
@@ -324,6 +324,16 @@ Get stats for a campaign
|
|
324
324
|
AhoyEmail.stats("my-campaign")
|
325
325
|
```
|
326
326
|
|
327
|
+
## HTML Parsing
|
328
|
+
|
329
|
+
By default, Nokogiri’s default HTML parser is used to rewrite links for UTM tagging and click analytics. This currently uses HTML4, which [only allows inline elements inside links](https://github.com/sparklemotion/nokogiri/issues/1876#issuecomment-468276937).
|
330
|
+
|
331
|
+
To use HTML5 parsing, create `config/initializers/ahoy_email.rb` with:
|
332
|
+
|
333
|
+
```ruby
|
334
|
+
AhoyEmail.default_options[:html5] = true
|
335
|
+
```
|
336
|
+
|
327
337
|
## History
|
328
338
|
|
329
339
|
View the [changelog](https://github.com/ankane/ahoy_email/blob/master/CHANGELOG.md)
|
@@ -25,7 +25,7 @@ module Ahoy
|
|
25
25
|
end
|
26
26
|
|
27
27
|
redirect_options = {}
|
28
|
-
redirect_options[:allow_other_host] = true
|
28
|
+
redirect_options[:allow_other_host] = true
|
29
29
|
|
30
30
|
if AhoyEmail::Utils.signature_verified?(legacy: legacy, token: token, campaign: campaign, url: url, signature: signature)
|
31
31
|
data = {}
|
data/lib/ahoy_email/engine.rb
CHANGED
@@ -11,7 +11,7 @@ module AhoyEmail
|
|
11
11
|
creds =
|
12
12
|
if app.respond_to?(:credentials) && app.credentials.secret_key_base
|
13
13
|
app.credentials
|
14
|
-
elsif app.respond_to?(:secrets) &&
|
14
|
+
elsif app.respond_to?(:secrets) && app.config.paths["config/secrets"].existent.any?
|
15
15
|
app.secrets
|
16
16
|
else
|
17
17
|
app.config
|
data/lib/ahoy_email/mailer.rb
CHANGED
@@ -63,6 +63,9 @@ module AhoyEmail
|
|
63
63
|
# only call other options if needed
|
64
64
|
if options[key]
|
65
65
|
AhoyEmail::Utils::OPTION_KEYS[key].each do |k|
|
66
|
+
# make sure html5 only called once
|
67
|
+
next if options.key?(k)
|
68
|
+
|
66
69
|
v = ahoy_options[k]
|
67
70
|
options[k] = v.respond_to?(:call) ? instance_exec(&v) : v
|
68
71
|
end
|
data/lib/ahoy_email/processor.rb
CHANGED
@@ -53,7 +53,7 @@ module AhoyEmail
|
|
53
53
|
if html_part?
|
54
54
|
part = message.html_part || message
|
55
55
|
|
56
|
-
doc =
|
56
|
+
doc = parser_class.parse(part.body.raw_source)
|
57
57
|
doc.css("a[href]").each do |link|
|
58
58
|
uri = parse_uri(link["href"])
|
59
59
|
next unless trackable?(uri)
|
@@ -92,6 +92,19 @@ module AhoyEmail
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
+
# use document instead of fragment
|
96
|
+
# https://github.com/ankane/ahoy_email/pull/150
|
97
|
+
def parser_class
|
98
|
+
case options[:html5]
|
99
|
+
when true
|
100
|
+
Nokogiri::HTML5::Document
|
101
|
+
when false
|
102
|
+
Nokogiri::HTML4::Document
|
103
|
+
else
|
104
|
+
Nokogiri::HTML::Document
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
95
108
|
def html_part?
|
96
109
|
(message.html_part || message).content_type =~ /html/
|
97
110
|
end
|
data/lib/ahoy_email/utils.rb
CHANGED
@@ -2,8 +2,8 @@ module AhoyEmail
|
|
2
2
|
class Utils
|
3
3
|
OPTION_KEYS = {
|
4
4
|
message: %i(message mailer user extra),
|
5
|
-
utm_params: %i(utm_source utm_medium utm_term utm_content utm_campaign),
|
6
|
-
click: %i(campaign url_options unsubscribe_links)
|
5
|
+
utm_params: %i(utm_source utm_medium utm_term utm_content utm_campaign html5),
|
6
|
+
click: %i(campaign url_options unsubscribe_links html5)
|
7
7
|
}
|
8
8
|
|
9
9
|
class << self
|
data/lib/ahoy_email/version.rb
CHANGED
data/lib/ahoy_email.rb
CHANGED
@@ -34,8 +34,11 @@ module Ahoy
|
|
34
34
|
when "lockbox"
|
35
35
|
"t.text :to_ciphertext\n t.string :to_bidx, index: true"
|
36
36
|
else
|
37
|
-
|
38
|
-
|
37
|
+
if encryption == "activerecord" && mysql?
|
38
|
+
"t.string :to, limit: 510, index: true"
|
39
|
+
else
|
40
|
+
"t.string :to, index: true"
|
41
|
+
end
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
@@ -63,6 +66,14 @@ module Ahoy
|
|
63
66
|
"has_encrypted"
|
64
67
|
end
|
65
68
|
end
|
69
|
+
|
70
|
+
def mysql?
|
71
|
+
adapter =~ /mysql|trilogy/i
|
72
|
+
end
|
73
|
+
|
74
|
+
def adapter
|
75
|
+
ActiveRecord::Base.connection_db_config.adapter.to_s
|
76
|
+
end
|
66
77
|
end
|
67
78
|
end
|
68
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahoy_email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: actionmailer
|
@@ -16,14 +15,14 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
18
|
+
version: '7.1'
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
25
|
+
version: '7.1'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: addressable
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +65,6 @@ dependencies:
|
|
66
65
|
- - ">="
|
67
66
|
- !ruby/object:Gem::Version
|
68
67
|
version: '0.4'
|
69
|
-
description:
|
70
68
|
email: andrew@ankane.org
|
71
69
|
executables: []
|
72
70
|
extensions: []
|
@@ -108,7 +106,6 @@ homepage: https://github.com/ankane/ahoy_email
|
|
108
106
|
licenses:
|
109
107
|
- MIT
|
110
108
|
metadata: {}
|
111
|
-
post_install_message:
|
112
109
|
rdoc_options: []
|
113
110
|
require_paths:
|
114
111
|
- lib
|
@@ -116,15 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
113
|
requirements:
|
117
114
|
- - ">="
|
118
115
|
- !ruby/object:Gem::Version
|
119
|
-
version: '3'
|
116
|
+
version: '3.2'
|
120
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
118
|
requirements:
|
122
119
|
- - ">="
|
123
120
|
- !ruby/object:Gem::Version
|
124
121
|
version: '0'
|
125
122
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
127
|
-
signing_key:
|
123
|
+
rubygems_version: 3.6.7
|
128
124
|
specification_version: 4
|
129
125
|
summary: First-party email analytics for Rails
|
130
126
|
test_files: []
|