action_trace 0.7.0 → 0.9.0

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: 182fd04b0f3e966ecc924f62325b816114084b5fa6fc4b726718421f0b0f8b40
4
- data.tar.gz: f86112724bb6802802e7e29491655f40365103c07fcc904647ea939870af0721
3
+ metadata.gz: 87cdc0bf9fdd706f3281fea43d22c6ae6bbeb75a49aa595dc3b0da237003c2f8
4
+ data.tar.gz: bc9f95661a4d297ea5d0a604eac591e20008c66b53523d720fcabff254c5b651
5
5
  SHA512:
6
- metadata.gz: 6a073a53162b28c8483a37bfb4270fbb085ce2880f27e8bdca5fc2a5d03c3b2abf77e8b53b01711c2f98c56d5f7d3ebb9333c38d042fe7663036c4012475240a
7
- data.tar.gz: 83de77162cf7b55ad76a002757e11daa334066191f2b8228e922c32515015fe91b9d76cb8fba57c76f1ecfc532d1d605a89674dd5dc71b51ecc87220fd0dff42
6
+ metadata.gz: 27a038ca8bd66c44e59eb57e7208fb19d1241877b6238bc4c3736f3a85c7ad62ac85f677dd6cbb7cffbe3122e1cd1d7f6763a3a0e7afad4f751ba63c7e35fdf3
7
+ data.tar.gz: dee5ead60152d867fac30d4bfb42f48ec143deb7c37f3222f4496d349a8f48eda852ff0dbfc5f069a465776a099dadb8742ca18c935eec1e0f55af872eb57722
@@ -39,16 +39,16 @@ module ActivityLogFetchable
39
39
  def apply_activity_type_filter(scope)
40
40
  return scope if context.source.blank?
41
41
 
42
- case context.source
43
- when ActionTrace::ActivityLog::SOURCES[:data_destroy]
44
- scope.where('activities.`key` LIKE ?', '%.destroy')
45
- when ActionTrace::ActivityLog::SOURCES[:data_change]
46
- scope.where('activities.`key` LIKE ?', '%.update')
47
- when ActionTrace::ActivityLog::SOURCES[:data_create]
48
- scope.where('activities.`key` LIKE ?', '%.create')
49
- else
50
- scope
51
- end
42
+ key_column = PublicActivity::Activity.arel_table[:key]
43
+
44
+ suffix = case context.source
45
+ when ActionTrace::ActivityLog::SOURCES[:data_destroy] then '%.destroy'
46
+ when ActionTrace::ActivityLog::SOURCES[:data_change] then '%.update'
47
+ when ActionTrace::ActivityLog::SOURCES[:data_create] then '%.create'
48
+ else return scope
49
+ end
50
+
51
+ scope.where(key_column.matches(suffix))
52
52
  end
53
53
 
54
54
  def apply_date_filters(scope, model_class)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionTrace
4
- VERSION = '0.7.0'
4
+ VERSION = '0.9.0'
5
5
  end
@@ -14,3 +14,17 @@ end
14
14
  PublicActivity::Config.set do
15
15
  enabled true
16
16
  end
17
+
18
+ class Ahoy::Store < Ahoy::DatabaseStore
19
+ def track_event(data)
20
+ props = data[:properties] || {}
21
+ ctrl = props["controller"]
22
+ action = props["action"]
23
+
24
+ excluded =
25
+ ActionTrace.configuration.excluded_controllers.include?(ctrl) ||
26
+ ActionTrace.configuration.excluded_actions.include?(action)
27
+
28
+ super unless excluded
29
+ end
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_trace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gimbaro