nuntius 1.4.13 → 1.4.14
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/controllers/nuntius/subscribers_controller.rb +1 -0
- data/app/models/nuntius/message.rb +2 -0
- data/app/models/nuntius/subscriber.rb +10 -0
- data/app/providers/nuntius/smtp_mail_provider.rb +7 -0
- data/app/services/nuntius/deliver_campaign_service.rb +2 -7
- data/app/tables/nuntius/campaigns_table.rb +1 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/nl.yml +1 -0
- data/db/migrate/20260310153208_add_subscriber_to_message.rb +5 -0
- data/lib/nuntius/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 650cc4b129b084d4fb17dd3b3b21c2a44f9cf14fb6c10d0d3902baa67bfb66fb
|
|
4
|
+
data.tar.gz: 004110c56dc8b127dc38170a5249135ff1d71700f219aa460b8e62866cdc2107
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6f3601b35b149815c37e3056e003d0a6e6900bd20b7bdcd2b17f82b04170fd873ac6aebe85cf3da41f351f11080420e350f2dd554bfd6f026ea2c75c91d4e623
|
|
7
|
+
data.tar.gz: 9c48531460a4e2d1c5f8a7747ef17712e128ee00f1f57e78d6187a615d3bcd97485ee268b1dd33b445b1e29ab0b5e0ff280c01a7cfab13f9726f6a72cc6d5416
|
|
@@ -5,6 +5,7 @@ require_dependency "nuntius/application_controller"
|
|
|
5
5
|
module Nuntius
|
|
6
6
|
class SubscribersController < ApplicationController
|
|
7
7
|
# skip_before_action :authenticate_user!, only: %i[show destroy]
|
|
8
|
+
skip_before_action :verify_authenticity_token, only: :unsubscribe
|
|
8
9
|
layout "empty"
|
|
9
10
|
|
|
10
11
|
def show
|
|
@@ -18,6 +18,8 @@ module Nuntius
|
|
|
18
18
|
belongs_to :campaign, optional: true
|
|
19
19
|
belongs_to :template, optional: true
|
|
20
20
|
belongs_to :parent_message, class_name: "Message", optional: true
|
|
21
|
+
belongs_to :subscriber, optional: true
|
|
22
|
+
|
|
21
23
|
has_many :child_messages, class_name: "Message", foreign_key: "parent_message_id", dependent: :destroy
|
|
22
24
|
has_many :message_trackings, class_name: "MessageTracking", dependent: :destroy
|
|
23
25
|
|
|
@@ -32,5 +32,15 @@ module Nuntius
|
|
|
32
32
|
|
|
33
33
|
super
|
|
34
34
|
end
|
|
35
|
+
|
|
36
|
+
def link(campaign, message, tag: true)
|
|
37
|
+
link_text = campaign.metadata["subscriber_url_text"] || I18n.t("subscriber_url_text")
|
|
38
|
+
url = Nuntius::Engine.routes.url_helpers.subscriber_url(self, host: Nuntius.config.host(message), protocol: "https")
|
|
39
|
+
tag ? "<a href=\"#{url}\" data-nuntius-tracking=\"false\">#{link_text}</a>" : url
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def unsubscribe_link(campaign, message)
|
|
43
|
+
Nuntius::Engine.routes.url_helpers.unsubscribe_subscriber_url(self, host: Nuntius.config.host(message), protocol: "https")
|
|
44
|
+
end
|
|
35
45
|
end
|
|
36
46
|
end
|
|
@@ -25,6 +25,13 @@ module Nuntius
|
|
|
25
25
|
Mail.new(from: from_header)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
mail.header["X-Nuntius-Message-Id"] = message.id
|
|
29
|
+
|
|
30
|
+
if message.campaign.present? && message.subscriber.present?
|
|
31
|
+
mail.header["List-Unsubscribe"] = "<" + message.subscriber.unsubscribe_link(message.campaign, message) + ">"
|
|
32
|
+
mail.header["List-Unsubscribe-Post"] = "List-Unsubscribe=One-Click"
|
|
33
|
+
end
|
|
34
|
+
|
|
28
35
|
if Rails.env.test?
|
|
29
36
|
mail.delivery_method :test
|
|
30
37
|
else
|
|
@@ -22,11 +22,11 @@ module Nuntius
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def new_message(subscriber, assigns = {})
|
|
25
|
-
message = Nuntius::Message.create!(transport: campaign.transport, campaign: campaign, nuntiable: subscriber.nuntiable, metadata: campaign.metadata)
|
|
25
|
+
message = Nuntius::Message.create!(transport: campaign.transport, campaign: campaign, nuntiable: subscriber.nuntiable, metadata: campaign.metadata, subscriber: subscriber)
|
|
26
26
|
|
|
27
27
|
assigns["campaign"] = context.campaign
|
|
28
28
|
assigns["subscriber"] = subscriber
|
|
29
|
-
assigns["subscriber_link"] =
|
|
29
|
+
assigns["subscriber_link"] = subscriber.link(campaign, message)
|
|
30
30
|
|
|
31
31
|
if subscriber.nuntiable
|
|
32
32
|
name = Nuntius::BaseMessenger.liquid_variable_name_for(subscriber.nuntiable)
|
|
@@ -62,11 +62,6 @@ module Nuntius
|
|
|
62
62
|
scope.join(".")
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def subscriber_link(subscriber, message)
|
|
66
|
-
url = Nuntius::Engine.routes.url_helpers.subscriber_url(subscriber, host: Nuntius.config.host(message))
|
|
67
|
-
"<a href=\"#{url}\" data-nuntius-tracking=\"false\">#{t("subscriber_url_text")}</a>"
|
|
68
|
-
end
|
|
69
|
-
|
|
70
65
|
private
|
|
71
66
|
|
|
72
67
|
def render(attr, assigns, locale, options = {})
|
|
@@ -25,7 +25,7 @@ module Nuntius
|
|
|
25
25
|
show ->(campaign) { campaign.transport != "sms" && campaign.can_publish? }
|
|
26
26
|
link { |campaign| campaign.can_publish? ? nuntius.publish_admin_campaign_path(campaign) : nil }
|
|
27
27
|
icon "fa-solid fa-paper-plane"
|
|
28
|
-
link_attributes data: {"turbo-confirm": "
|
|
28
|
+
link_attributes data: {"turbo-confirm": t(".campaign_publish_confirm"), "turbo-method": :post}
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
order name: :asc
|
data/config/locales/en.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/lib/nuntius/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nuntius
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom de Grunt
|
|
@@ -553,6 +553,7 @@ files:
|
|
|
553
553
|
- db/migrate/20260123160443_change_nuntius_events_id.rb
|
|
554
554
|
- db/migrate/20260210122500_add_tracking_to_nuntius_messages.rb
|
|
555
555
|
- db/migrate/20260225123822_add_metadata_to_subscriber.rb
|
|
556
|
+
- db/migrate/20260310153208_add_subscriber_to_message.rb
|
|
556
557
|
- lib/generators/nuntius/install_generator.rb
|
|
557
558
|
- lib/generators/nuntius/tailwind_config_generator.rb
|
|
558
559
|
- lib/generators/nuntius/templates/config/initializers/nuntius.rb
|