ga_events 1.4.0 → 1.4.1

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
  SHA1:
3
- metadata.gz: e1146cf9971d12382e0aa793841cd4dd0cd76470
4
- data.tar.gz: ff69c78fb46afe03a40685cf8f002c82161a3e27
3
+ metadata.gz: d58cdb3aafef92d454bb79021d01ed65773e710d
4
+ data.tar.gz: 2b46d6a7bcb1906f68a95f100521c65644cfedc6
5
5
  SHA512:
6
- metadata.gz: b30b861e9b436375c7615d3f3b1aee65163a38236943eaa71482fa1ff6a6ead43929bc8e50ee91532006344995d7809122e4737e0f900e46254583b20aef5049
7
- data.tar.gz: 09e3a8b9a027f6cdeda57a5184a6d9b214edba3649bcdc6e666bf24f36d49d51b223a7c523234d47eb3b7c9a853ca77c4f92cbbdd42d54fc536430fe0a7b950d
6
+ metadata.gz: 8139269a9fa960a91f3fda4dd8bebc113fba30eaf84ecff627408aa446333e40e5d56a5eb792f71a588189c82d42d9c0d33c8a5524814530c407f4c87a11e123
7
+ data.tar.gz: 664f45cd5043f86e61608fd434e530dd71e4b0fdd4b14beff7a6f9adb3a6faffabc46c20048bb9b3466b0383b5726b360d5d126ef182754564f84495e6e4ec14
@@ -33,3 +33,9 @@ The format suggested at http://keepachangelog.com/ is used.
33
33
  changes orchestrated by turbolinks, events are no longer processed via the
34
34
  injected DOM node. (Because the node would be cached and the event already
35
35
  processed.) Instead the the header-strategy is being used.
36
+
37
+ ## 1.4.1 - 2018-04-03
38
+
39
+ ### Fixed
40
+ - Ensure category, action and label do not include any umlauts or ß chars
41
+ - Fixed an error where events are remaining after a redirect
@@ -32,11 +32,21 @@ class GaEvents.Event
32
32
  @klass.list.push @
33
33
  @klass.flush()
34
34
 
35
+ escape: (str) ->
36
+ return unless str
37
+ "#{str}".replace(/ä/g, "ae")
38
+ .replace(/ö/g, "oe")
39
+ .replace(/ü/g, "ue")
40
+ .replace(/Ä/g, "Ae")
41
+ .replace(/Ö/g, "Oe")
42
+ .replace(/Ü/g, "Ue")
43
+ .replace(/ß/g, "ss")
44
+
35
45
  to_hash: ->
36
- # Category, action and label must be of type string.
37
- action: "#{@action}"
38
- category: "#{@category}"
39
- label: "#{@label}"
46
+ # Category, action and label must be escaped and of type string.
47
+ action: @escape(@action)
48
+ category: @escape(@category)
49
+ label: @escape(@label)
40
50
  # Value has to be a positive integer or defaults to 1
41
51
  value: @to_positive_integer(@value)
42
52
 
@@ -43,15 +43,17 @@ module GaEvents
43
43
  # Fix for Rails 4
44
44
  flash &&= flash['flashes'] if Rails::VERSION::MAJOR > 3
45
45
 
46
- GaEvents::List.init(flash && flash['ga_events'])
46
+ # The key has to be removed from the flash here to ensure it does not
47
+ # remain after the finished redirect. This copies the behaviour of the
48
+ # "#use" and "#sweep" methods of the rails flash middleware:
49
+ # https://github.com/rails/rails/blob/v3.2.14/actionpack/lib/action_dispatch/middleware/flash.rb#L220
50
+ GaEvents::List.init(flash && flash.delete('ga_events'))
47
51
  end
48
52
 
49
53
  def add_events_to_flash env, serialized_data
50
54
  flash_hash = env[ActionDispatch::Flash::KEY]
51
55
  flash_hash ||= ActionDispatch::Flash::FlashHash.new
52
56
  flash_hash['ga_events'] = serialized_data
53
- # Discard the flash after the action completes.
54
- flash_hash.discard('ga_events')
55
57
 
56
58
  env[ActionDispatch::Flash::KEY] = flash_hash
57
59
  end
@@ -1,3 +1,3 @@
1
1
  module GaEvents
2
- VERSION = '1.4.0'.freeze
2
+ VERSION = '1.4.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ga_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Dütsch
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-12 00:00:00.000000000 Z
12
+ date: 2018-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 2.4.5.1
73
+ rubygems_version: 2.5.2
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: This gem allows you to annotate events everywhere in the code of your Rails