effective_logging 3.1.11 → 3.1.15

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: 793f67a081ade00db602453e788de2c7449ddefe2dc3884aa3d2c72046170cdb
4
- data.tar.gz: '08531a7570a1258c5709d177fbe7ca3a35448121d4b0bef24da63feba868a35c'
3
+ metadata.gz: 153343d7143b4f2705fc5a5fefcafc5f6832d128bc5f4f6273247cad0f88fb6a
4
+ data.tar.gz: d27a82f669877cdd3cce6c37426c03243b1255f03748070874527c921ffdf363
5
5
  SHA512:
6
- metadata.gz: ccc8e31fb99180d15e8ff5de19443ab8c1a4097650f90de6c4555c2776bb47fa4b0f24e6c2c9224d860c32c9b5250f3bcb13abcd01ffb050c4603c7ae30620ba
7
- data.tar.gz: 3ea1c48c81d890b7134b25af34667bb54311e30a04e5737bc4331cd9879d03b76dc993bcbbfdeaf35bcf566b9c8849ad8a8293dcc7553f13fa4ebcb23d027ba3
6
+ metadata.gz: 0be67e23da9dd7d63c720fd624efcc759c3a361eda73f1c0934c939ceefd555043c7b45fef2285f668e57109c2dcf18a0d470c02b13173d16a6edfa9d90ef3fd
7
+ data.tar.gz: f0c790dbb208cf6249d82acbf2ab6b4a79f7587e8520b3c98133c56c3708b287219253077ee2f4d6b7581eb767d435ed444384211932a803f2c721a9bcaa5c7c
@@ -20,7 +20,7 @@ class EffectiveLogsDatatable < Effective::Datatable
20
20
  col :associated_to_s, label: 'Associated'
21
21
 
22
22
  col :message do |log|
23
- (log.message || '').gsub!("\n", '<br>')
23
+ (log.message || '').gsub("\n", '<br>')
24
24
  end
25
25
 
26
26
  col :logs_count, visible: false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActsAsLoggable
2
4
  extend ActiveSupport::Concern
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Effective
2
4
  class Log < ActiveRecord::Base
3
5
  self.table_name = EffectiveLogging.logs_table_name.to_s
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Call EffectiveLog.info or EffectiveLog.success EffectiveLog.error
2
4
 
3
5
  class EffectiveLogger
data/config/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  EffectiveLogging::Engine.routes.draw do
2
4
  scope module: 'effective' do
3
5
  # Create is our javascript POST event for EffectiveLogging from JS side
@@ -3,6 +3,7 @@ module EffectiveLogging
3
3
  def self.delivering_email(message)
4
4
  return if EffectiveLogging.supressed?
5
5
  return unless message.present?
6
+ return unless ActiveRecord::Base.connection.table_exists?(:logs)
6
7
 
7
8
  # collect a Hash of arguments used to invoke EffectiveLogger.success
8
9
  fields = { from: message.from.join(','), to: message.to, subject: message.subject, cc: message.cc, bcc: message.bcc }
@@ -29,22 +30,21 @@ module EffectiveLogging
29
30
  # Pass a tenant to your mailer
30
31
  # mail(to: 'admin@example.com', subject: @post.title, tenant: Tenant.current)
31
32
  tenant = if message.header['tenant'].present?
32
- value = message.header['tenant'].to_s.to_sym # OptionalField, not a String here
33
+ value = Array(message.header['tenant']).first.to_s.to_sym # OptionalField, not a String here
33
34
  message.header['tenant'] = nil
34
35
  value
35
36
  end
36
37
 
37
- user_klass = "#{tenant.to_s.classify}::User".safe_constantize
38
-
39
38
  parts = (message.body.try(:parts) || []).map { |part| [part, (part.parts if part.respond_to?(:parts))] }.flatten
40
39
  body = parts.find { |part| part.content_type.to_s.downcase.include?('text/html') } || message.body
41
40
 
42
41
  fields[:email] = "#{message.header}<hr>#{body}"
43
42
 
44
43
  if tenant.present? && defined?(Tenant)
44
+ user_klass = (Tenant.engine_user(tenant) rescue nil)
45
45
  Tenant.as_if(tenant) { log_email(message, fields, user_klass) }
46
46
  else
47
- log_email(message, fields, user_klass)
47
+ log_email(message, fields, 'User'.safe_constantize)
48
48
  end
49
49
 
50
50
  true
@@ -1,3 +1,3 @@
1
1
  module EffectiveLogging
2
- VERSION = '3.1.11'.freeze
2
+ VERSION = '3.1.15'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.11
4
+ version: 3.1.15
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: 2021-09-21 00:00:00.000000000 Z
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails