effective_messaging 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a668f509158897d567a7b1e84716778f689884dd508727012d40d8a8670a29a
4
- data.tar.gz: 6c95fee8792b048e63eb0ad01345a8d1f8ee6dca3be2d1838f7b1775e21b0ac1
3
+ metadata.gz: fc984bf85e3e2cf47b5ceaae61d98dc2b336ea34d1ed802c439c7854beabc3b0
4
+ data.tar.gz: 2c695ed99c62e9b4d0d9a42f64d557fdabc8f151d0d5c32b28ed881c4de13385
5
5
  SHA512:
6
- metadata.gz: c6bec69c0c21ce2dbfad2c58080a80ae16021797e73dc0bb5bc70e1fe4cdbf194674b13afd894ba0896e2c86dfc044132bb03245532ba295f0a2f51efbfbda47
7
- data.tar.gz: 04046c99f01cb6a27841d456b32dc08f166af7fe425b73b369bf86a0cd8a237e05419242220faa06ff24fe7e83a79ab76008dc2df3af48b840acc08432650297
6
+ metadata.gz: 462f2e88796ea1a1b9e0af27abafe25c580f42ee8b75259ecde6af4a99c1044ba765f7f9c13c2764337f82e179fc2cf9e72e1e33420ff1a270fffef35b0df75d
7
+ data.tar.gz: 95c16f285e650a356c08c85b922385246912bb6c14fab53d406e722e9010bc123266bcc0941a94ca93ec98fb27d3e83fd3f7ccb4b1623bf90a3a7b66a2da73e4
@@ -37,13 +37,13 @@ module Admin
37
37
  col :notifiable_tomorrow_rows_count, label: 'Tomorrow'
38
38
 
39
39
  col(:rows_count) do |notification|
40
- notification.report.collection().count
40
+ notification.report&.collection()&.count.to_i
41
41
  end
42
42
 
43
43
  col :subject
44
44
  col :body, visible: false
45
45
 
46
- col :from, visible: false, search: Array(EffectiveMessaging.froms).presence
46
+ col :from, visible: false, search: EffectiveMessaging.mailer_froms
47
47
  col :cc, visible: false
48
48
  col :bcc, visible: false
49
49
 
@@ -83,7 +83,7 @@ module Effective
83
83
  scope :disabled, -> { where(enabled: false) }
84
84
 
85
85
  before_validation do
86
- self.from ||= EffectiveMessaging.froms.first
86
+ self.from ||= EffectiveMessaging.mailer_froms.first
87
87
  end
88
88
 
89
89
  # Emails or Report
@@ -55,13 +55,8 @@
55
55
  %h2 Notification
56
56
  %p The following email notification will be sent
57
57
 
58
- - froms = Array(EffectiveMessaging.froms) - [nil, '']
59
-
60
- - if froms.present?
61
- = f.radios :from, froms
62
- - else
63
- = f.email_field :from
64
-
58
+ - f.object.from ||= EffectiveMessaging.mailer_froms.first
59
+ = f.select :from, EffectiveMessaging.mailer_froms
65
60
  = f.email_field :bcc
66
61
  = f.text_field :subject
67
62
  = f.text_area :body, rows: 20
@@ -3,10 +3,6 @@ EffectiveMessaging.setup do |config|
3
3
  # Configure the Layout per controller, or all at once
4
4
  # config.layout = { application: 'application', admin: 'admin' }
5
5
 
6
- # From Settings
7
- # For the Admin new notification form. Set to an array to use a select, or nil to use a freeform text entry
8
- config.froms = ['noreply@example.com']
9
-
10
6
  # Mailer Settings
11
7
  # Please see config/initializers/effective_messaging.rb for default effective_* gem mailer settings
12
8
  #
@@ -19,6 +15,7 @@ EffectiveMessaging.setup do |config|
19
15
  # config.deliver_method = nil # The deliver method, deliver_later or deliver_now
20
16
  # config.mailer_layout = nil # Default mailer layout
21
17
  # config.mailer_sender = nil # Default From value
18
+ # config.mailer_froms = nil # Default Froms collection
22
19
  # config.mailer_admin = nil # Default To value for Admin correspondence
23
20
  # config.mailer_subject = nil # Proc.new method used to customize Subject
24
21
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveMessaging
2
- VERSION = '0.5.5'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
@@ -10,7 +10,7 @@ module EffectiveMessaging
10
10
  :chats_table_name, :chat_users_table_name, :chat_messages_table_name, :notifications_table_name, :notification_logs_table_name,
11
11
  :layout,
12
12
  :froms,
13
- :mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject
13
+ :mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_froms, :mailer_admin, :mailer_subject
14
14
  ]
15
15
  end
16
16
 
@@ -14,10 +14,10 @@ namespace :effective_messaging do
14
14
  begin
15
15
  notification.notify!
16
16
  Rails.logger.info "Sent notifications for #{notification} and #{notification.report}"
17
- rescue => e
17
+ rescue StandardError => e
18
18
  data = { notification_id: notification.id, report_id: notification.report_id, resource_id: notification.current_resource&.id }
19
19
  ExceptionNotifier.notify_exception(e, data: data) if defined?(ExceptionNotifier)
20
- puts "Error with effective_messaging #{notification.id} resource #{notification.current_resource&.id}: #{e.errors.inspect}"
20
+ puts "Error with effective_messaging #{notification.id} resource #{notification.current_resource&.id}: #{notification.errors.inspect}"
21
21
  end
22
22
  end
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-28 00:00:00.000000000 Z
11
+ date: 2023-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails