mailkick 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -63
- data/lib/mailkick/engine.rb +1 -1
- data/lib/mailkick/model.rb +1 -1
- data/lib/mailkick/service/postmark.rb +1 -1
- data/lib/mailkick/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a9bd60adb2d9f1ce219b451369a4c5547f3dea808fa3123e31fb317fccfe843
|
4
|
+
data.tar.gz: 9fab1707325fdc093ddc9123c94d331d6c7b4b17ceaae1d5f8760cdb30b4f74b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f1160fff3f3ef81e4ff3d2ab9fae04076e84db93f95ab17f1655a99185331c22783c262dac0433484575371bebedc05750744a1434fdfa6f9d32cac87609050
|
7
|
+
data.tar.gz: f0cfecb317f7fc74848ec9479248f635f268194bfd9d4c38ecda06cb3ec9815eb9c17d8b9044ca38ca0dd459a5e3fe9d8acfefd3d7953ded84b132bb5286a9ff
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Email subscriptions for Rails
|
|
7
7
|
|
8
8
|
:postbox: Check out [Ahoy Email](https://github.com/ankane/ahoy_email) for analytics
|
9
9
|
|
10
|
-
[![Build Status](https://github.com/ankane/mailkick/workflows/build/badge.svg
|
10
|
+
[![Build Status](https://github.com/ankane/mailkick/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/mailkick/actions)
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -209,68 +209,6 @@ Access the subscription model directly
|
|
209
209
|
Mailkick::Subscription.all
|
210
210
|
```
|
211
211
|
|
212
|
-
## Upgrading
|
213
|
-
|
214
|
-
### 1.0
|
215
|
-
|
216
|
-
Mailkick 1.0 stores subscriptions instead of opt-outs. To migrate:
|
217
|
-
|
218
|
-
1. Add a table to store subscriptions
|
219
|
-
|
220
|
-
```sh
|
221
|
-
rails generate mailkick:install
|
222
|
-
rails db:migrate
|
223
|
-
```
|
224
|
-
|
225
|
-
2. Change the following methods in your code:
|
226
|
-
|
227
|
-
- `mailkick_user` to `has_subscriptions`
|
228
|
-
- `User.not_opted_out` to `User.subscribed(list)`
|
229
|
-
- `opt_in` to `subscribe(list)`
|
230
|
-
- `opt_out` to `unsubscribe(list)`
|
231
|
-
- `opted_out?` to `!subscribed?(list)`
|
232
|
-
|
233
|
-
3. Add a user and list to `mailkick_unsubscribe_url`
|
234
|
-
|
235
|
-
```ruby
|
236
|
-
mailkick_unsubscribe_url(user, list)
|
237
|
-
```
|
238
|
-
|
239
|
-
4. Migrate data for each of your lists
|
240
|
-
|
241
|
-
```ruby
|
242
|
-
opted_out_emails = Mailkick::Legacy.opted_out_emails(list: nil)
|
243
|
-
opted_out_users = Mailkick::Legacy.opted_out_users(list: nil)
|
244
|
-
|
245
|
-
User.find_in_batches do |users|
|
246
|
-
users.reject! { |u| opted_out_emails.include?(u.email) }
|
247
|
-
users.reject! { |u| opted_out_users.include?(u) }
|
248
|
-
|
249
|
-
now = Time.now
|
250
|
-
records =
|
251
|
-
users.map do |user|
|
252
|
-
{
|
253
|
-
subscriber_type: user.class.name,
|
254
|
-
subscriber_id: user.id,
|
255
|
-
list: "sales",
|
256
|
-
created_at: now,
|
257
|
-
updated_at: now
|
258
|
-
}
|
259
|
-
end
|
260
|
-
|
261
|
-
# use create! for Active Record < 6
|
262
|
-
Mailkick::Subscription.insert_all!(records)
|
263
|
-
end
|
264
|
-
```
|
265
|
-
|
266
|
-
5. Drop the `mailkick_opt_outs` table
|
267
|
-
|
268
|
-
```ruby
|
269
|
-
drop_table :mailkick_opt_outs
|
270
|
-
```
|
271
|
-
|
272
|
-
Also, if you use `Mailkick.fetch_opt_outs`, [add a method](#bounces-and-spam-reports) to handle opt outs.
|
273
|
-
|
274
212
|
## History
|
275
213
|
|
276
214
|
View the [changelog](https://github.com/ankane/mailkick/blob/master/CHANGELOG.md)
|
data/lib/mailkick/engine.rb
CHANGED
@@ -13,7 +13,7 @@ module Mailkick
|
|
13
13
|
creds =
|
14
14
|
if app.respond_to?(:credentials) && app.credentials.secret_key_base
|
15
15
|
app.credentials
|
16
|
-
elsif app.respond_to?(:secrets)
|
16
|
+
elsif app.respond_to?(:secrets) && (Rails::VERSION::STRING.to_f < 7.1 || app.config.paths["config/secrets"].existent.any?)
|
17
17
|
app.secrets
|
18
18
|
else
|
19
19
|
app.config
|
data/lib/mailkick/model.rb
CHANGED
@@ -3,7 +3,7 @@ module Mailkick
|
|
3
3
|
def has_subscriptions
|
4
4
|
class_eval do
|
5
5
|
has_many :mailkick_subscriptions, class_name: "Mailkick::Subscription", as: :subscriber
|
6
|
-
scope :subscribed, ->
|
6
|
+
scope :subscribed, ->(list) { joins(:mailkick_subscriptions).where(mailkick_subscriptions: {list: list}) }
|
7
7
|
|
8
8
|
def subscribe(list)
|
9
9
|
mailkick_subscriptions.where(list: list).first_or_create!
|
data/lib/mailkick/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailkick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.5.
|
78
|
+
rubygems_version: 3.5.16
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Email subscriptions for Rails
|