nuntius 1.4.12 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8ef496cc1318a53abc2466b813146bbe86f28cbfc2e2ec5e32956e1189007cb
4
- data.tar.gz: 4bfdacc8786460d484f635a70dfb92add44d31928dc068f9e41664730352ec22
3
+ metadata.gz: 650cc4b129b084d4fb17dd3b3b21c2a44f9cf14fb6c10d0d3902baa67bfb66fb
4
+ data.tar.gz: 004110c56dc8b127dc38170a5249135ff1d71700f219aa460b8e62866cdc2107
5
5
  SHA512:
6
- metadata.gz: abc30a1e3bad34fe6b7cbbc0a4b1cfef187ea0e9528039b248aebcee50dcf4c6604d85d855555227c8a35a2a0ba383a9924bbd0bb5f39d0211b78fd074627972
7
- data.tar.gz: a539160365f1f8cfab219a8ad0b582241c8a2cfe1bb8b397d0b0050f805f9fd42c8d6ae5d43dc844c0da542af46c2c8858de7d4b63d7f8d35af4c22ab2ffb920
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
@@ -15,6 +15,7 @@ module Nuntius
15
15
  setting_reader :ssl, required: false, default: false, description: "Whether to use SSL or not"
16
16
 
17
17
  def deliver
18
+ return no_recipient if message.to.blank?
18
19
  return block unless MailAllowList.new(settings[:allow_list]).allowed?(message.to)
19
20
  return block if Nuntius::Message.where(status: %w[complaint bounced], to: message.to).count >= 1
20
21
 
@@ -24,6 +25,13 @@ module Nuntius
24
25
  Mail.new(from: from_header)
25
26
  end
26
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
+
27
35
  if Rails.env.test?
28
36
  mail.delivery_method :test
29
37
  else
@@ -85,6 +93,11 @@ module Nuntius
85
93
  message
86
94
  end
87
95
 
96
+ def no_recipient
97
+ message.status = "no_recipient"
98
+ message
99
+ end
100
+
88
101
  private
89
102
 
90
103
  def message_url(message)
@@ -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"] = subscriber_link(subscriber, message)
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": "Are you sure you want to send out this campaign?", "turbo-method": :post}
28
+ link_attributes data: {"turbo-confirm": t(".campaign_publish_confirm"), "turbo-method": :post}
29
29
  end
30
30
 
31
31
  order name: :asc
@@ -4,15 +4,13 @@ module Nuntius
4
4
  class MailTransport < BaseTransport
5
5
  # We split per email address, to allow easy resends
6
6
  def deliver(message)
7
- message.html = Inky::Core.new.release_the_kraken(message.html)
8
-
9
7
  premailer = Premailer.new(message.html, with_html_string: true)
10
8
  message.html = premailer.to_inline_css
11
9
  message.text = premailer.to_plain_text
12
10
 
13
11
  message.request_id = SecureRandom.uuid
14
12
 
15
- tos = message.to.split(/[\s;,]+/)
13
+ tos = message.to.to_s.split(/[\s;,]+/)
16
14
 
17
15
  messages = []
18
16
  message.to = tos.first
@@ -2,8 +2,8 @@
2
2
  = sts.card :subscriber, title: @list.name do |card|
3
3
  - card.with_action
4
4
  - if @subscriber.unsubscribed_at.present?
5
- = link_to 'Resubscribe', subscribe_subscriber_path(@subscriber), data: { turbo_method: :post }, class: 'button'
5
+ = link_to t('.resubscribe'), subscribe_subscriber_path(@subscriber), data: { turbo_method: :post }, class: 'button'
6
6
  - else
7
- = link_to 'Unsubscribe', unsubscribe_subscriber_path(@subscriber), data: { turbo_method: :post }, class: 'button primary'
7
+ = link_to t('.unsubscribe'), unsubscribe_subscriber_path(@subscriber), data: { turbo_method: :post }, class: 'button primary'
8
8
 
9
9
  p== sanitize @list.description
@@ -1,4 +1,5 @@
1
1
  en:
2
+ campaign_publish_confirm: "Are you sure you want to send out this campaign?"
2
3
  subscriber_url_text: "Click here to unsubscribe"
3
4
  choose_files: Choose files
4
5
  activerecord:
@@ -178,6 +179,10 @@ en:
178
179
  tab:
179
180
  Nuntius templates: Templates
180
181
  title: Templates
182
+ subscribers:
183
+ show:
184
+ unsubscribe: Unsubscribe
185
+ resubscribe: Resubscribe
181
186
  context_menu:
182
187
  resend: Resend
183
188
  root: Root
@@ -1,5 +1,6 @@
1
1
  nl:
2
- subscriber_url_text: "Klik hier om uit te schrijven"
2
+ campaign_publish_confirm: "Weet je zeker dat je deze campagne wilt verzenden?"
3
+ subscriber_url_text: "Klik hier om je uit te schrijven"
3
4
  choose_files: Kies bestanden
4
5
  activerecord:
5
6
  attributes:
@@ -193,6 +194,10 @@ nl:
193
194
  tab:
194
195
  Nuntius templates: Templates
195
196
  title: Templates
197
+ subscribers:
198
+ show:
199
+ unsubscribe: Uitschrijven
200
+ resubscribe: Opnieuw inschrijven
196
201
  context_menu:
197
202
  resend: Verstuur opnieuw
198
203
  root: Root
@@ -0,0 +1,5 @@
1
+ class AddSubscriberToMessage < ActiveRecord::Migration[8.1]
2
+ def change
3
+ add_reference :nuntius_messages, :subscriber, null: true, type: :uuid, foreign_key: {to_table: :nuntius_subscribers}
4
+ end
5
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "auxilium"
4
- require "inky"
5
4
  require "faraday"
6
5
  require "faraday/follow_redirects"
7
6
  require "liquidum"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nuntius
4
- VERSION = "1.4.12"
4
+ VERSION = "1.4.14"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nuntius
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.12
4
+ version: 1.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-27 00:00:00.000000000 Z
11
+ date: 2026-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apnotic
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.8.5
111
- - !ruby/object:Gem::Dependency
112
- name: inky-rb
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '1.4'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.4'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: labelary
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -567,6 +553,7 @@ files:
567
553
  - db/migrate/20260123160443_change_nuntius_events_id.rb
568
554
  - db/migrate/20260210122500_add_tracking_to_nuntius_messages.rb
569
555
  - db/migrate/20260225123822_add_metadata_to_subscriber.rb
556
+ - db/migrate/20260310153208_add_subscriber_to_message.rb
570
557
  - lib/generators/nuntius/install_generator.rb
571
558
  - lib/generators/nuntius/tailwind_config_generator.rb
572
559
  - lib/generators/nuntius/templates/config/initializers/nuntius.rb