effective_logging 1.11.0 → 1.11.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 764110851ffd8e9238e69e60a0dc08e1f210c6fa
|
4
|
+
data.tar.gz: 9090700d036500ba51819420446f5feeb941b0e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 270572880bdf24cca71708c5076c8920a06a186fa2c8db87c82020e1fc4f992e7cec9f2701e1bdb23152f428df053f59a66ec189a4e653fa22fc302ab9fa2df6
|
7
|
+
data.tar.gz: d6eedad46a7b9fe2bb010b28cb58d0b2738962e4d39d90e032439d01252aeff46a25189524a7247d1af0f721dac28ed5522b641c9a7c683229ca0531287b1a39
|
data/README.md
CHANGED
@@ -321,7 +321,7 @@ If you don't want to use the builtin Admin screen, and would rather render the e
|
|
321
321
|
In your controller:
|
322
322
|
|
323
323
|
```ruby
|
324
|
-
@datatable = EffectiveLogsDatatable.new
|
324
|
+
@datatable = EffectiveLogsDatatable.new
|
325
325
|
```
|
326
326
|
|
327
327
|
And then in your view:
|
@@ -334,13 +334,11 @@ render_datatable(@datatable)
|
|
334
334
|
|
335
335
|
We can also use a similar method to create a datatable of logs for just one user.
|
336
336
|
|
337
|
-
When initialized with :
|
338
|
-
|
339
|
-
In your controller:
|
337
|
+
When initialized with :for, the logs are scoped to any log where this id matches the User or Associated column.
|
340
338
|
|
341
339
|
```ruby
|
342
|
-
@user
|
343
|
-
|
340
|
+
EffectiveLogsDatatable.new(for: @user.id)
|
341
|
+
EffectiveLogsDatatable.new(for: [1, 2, 3]) # Users with ID 1, 2 and 3
|
344
342
|
```
|
345
343
|
|
346
344
|
|
@@ -8,10 +8,8 @@ unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
|
|
8
8
|
|
9
9
|
if attributes[:user] == false
|
10
10
|
# Do not include
|
11
|
-
elsif attributes[:
|
12
|
-
col :user, search:
|
13
|
-
elsif attributes[:user].present?
|
14
|
-
col :user, search: { collection: User.where(id: Array(attributes[:user]).map { |user| user.to_param }) }
|
11
|
+
elsif attributes[:for]
|
12
|
+
col :user, search: :string
|
15
13
|
else
|
16
14
|
col :user
|
17
15
|
end
|
@@ -54,8 +52,8 @@ unless Gem::Version.new(EffectiveDatatables::VERSION) < Gem::Version.new('3.0')
|
|
54
52
|
scope = scope.where(status: EffectiveLogging.log_changes_status)
|
55
53
|
end
|
56
54
|
|
57
|
-
if
|
58
|
-
user_ids = Array(attributes[:
|
55
|
+
if attributes[:for]
|
56
|
+
user_ids = Array(attributes[:for])
|
59
57
|
scope = scope.where('user_id IN (?) OR (associated_id IN (?) AND associated_type = ?)', user_ids, user_ids, 'User')
|
60
58
|
end
|
61
59
|
|
@@ -21,8 +21,11 @@ module EffectiveLogging
|
|
21
21
|
logged_fields[:email] = "#{message.header}<hr>#{(body.presence || message.body)}"
|
22
22
|
|
23
23
|
(message.to || []).each do |to|
|
24
|
+
user = (User.where(email: to).first rescue nil)
|
25
|
+
|
24
26
|
logged_fields[:to] = to
|
25
|
-
logged_fields[:associated] ||=
|
27
|
+
logged_fields[:associated] ||= user
|
28
|
+
logged_fields[:user] ||= user
|
26
29
|
|
27
30
|
::EffectiveLogger.email("#{message.subject} - #{message.to.join(', ')}", logged_fields)
|
28
31
|
end
|
@@ -34,7 +34,7 @@ module EffectiveLogging
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
#
|
37
|
+
# Register the log_page_views concern so that it can be called in ActionController or elsewhere
|
38
38
|
initializer 'effective_logging.log_changes_action_controller' do |app|
|
39
39
|
Rails.application.config.to_prepare do
|
40
40
|
ActiveSupport.on_load :action_controller do
|
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: 1.11.
|
4
|
+
version: 1.11.1
|
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: 2017-
|
11
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|