studio-engine 0.43.0 → 0.44.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/app/mailers/studio/newsletter_mailer.rb +20 -2
- data/lib/studio/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a0bd2a31039b41d7b5f7fe70a6865308d2fec97e6bfeae301f254b173352dc2
|
|
4
|
+
data.tar.gz: 14e41f376424c34cd73c92eae84310eb18b24dc2165ac727948d7d9cbed9379a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '097bd2947f0e2c0a02a21b76cb01ed7816fd1c7ff1cc077576a15b8e125ef3e13ce81ac7a0c8500de367c37f663cd8d1cdfb4599511f760efe6a9e2994fdbaeb'
|
|
7
|
+
data.tar.gz: 72b9f3066838d5494036601d29a0de70a6c33d69e84ccfcd788e459e493f16d5a9b1c130a7b3c36c8604081823ddb8fa9274e5b61eef97da0246ace104e70392
|
|
@@ -19,7 +19,20 @@ module Studio
|
|
|
19
19
|
# unsubscribe_url is OPTIONAL and the line renders only when it is given.
|
|
20
20
|
# A newsletter needs a way out, but a hard-coded dead link is worse than an
|
|
21
21
|
# honest omission — a host wires its real one and the line appears.
|
|
22
|
-
|
|
22
|
+
#
|
|
23
|
+
# `from` is OPTIONAL on the same terms, and it exists for a reason worth
|
|
24
|
+
# stating: THIS EMAIL IS MARKETING, and the rest of what this engine sends
|
|
25
|
+
# is transactional. A host that keeps a separate marketing address does so
|
|
26
|
+
# to protect the reputation of the address its SIGN-IN LINKS go out on —
|
|
27
|
+
# complaints and unsubscribes against a newsletter must not follow the
|
|
28
|
+
# address someone needs to get back into their account. Without this
|
|
29
|
+
# parameter a host with that separation could not migrate onto this mailer
|
|
30
|
+
# without giving it up, which is a deliverability regression disguised as an
|
|
31
|
+
# adoption.
|
|
32
|
+
#
|
|
33
|
+
# Omitted, nothing changes: ActionMailer falls back to the default_from the
|
|
34
|
+
# host already configured.
|
|
35
|
+
def subscribed(email, name: nil, unsubscribe_url: nil, from: nil)
|
|
23
36
|
@app_name = Studio.app_name
|
|
24
37
|
@email = email
|
|
25
38
|
@name = name.presence
|
|
@@ -41,7 +54,12 @@ module Studio
|
|
|
41
54
|
|
|
42
55
|
subject = Studio::EmailCatalog.subject_for(:newsletter_subscribed, name: @name) ||
|
|
43
56
|
"You're subscribed to #{@app_name}"
|
|
44
|
-
|
|
57
|
+
# Built conditionally rather than passing `from: nil`: ActionMailer treats
|
|
58
|
+
# an explicit nil as a SET header and drops the host's default_from,
|
|
59
|
+
# sending with no From at all.
|
|
60
|
+
headers = { to: email, subject: subject }
|
|
61
|
+
headers[:from] = from if from.present?
|
|
62
|
+
mail(**headers)
|
|
45
63
|
end
|
|
46
64
|
end
|
|
47
65
|
end
|
data/lib/studio/version.rb
CHANGED