Skip to content

Commit ac51d5d

Browse files
authored
Merge pull request #119 from MindscapeHQ/fix-affected-user-tracking
Use lowercase user identifier keys
2 parents d6967fd + 1b5221f commit ac51d5d

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
## 2.2.0
1+
## 2.3.0 (09/05/2017)
2+
3+
Bugfixes
4+
- Fix issue preventing affected users for a crash report from showing up in the affected users page ([#119](https://github.com/MindscapeHQ/raygun4ruby/pull/119))
5+
6+
## 2.2.0 (05/05/2017)
27

38
Features
49
- Opt in support for sending exceptions in a background thread to not block web request thread during IO ([#117](https://github.com/MindscapeHQ/raygun4ruby/pull/117))
510

611
Bugfixes
712
- Don't attempt to read raw data during GET requests or if rack.input buffer is empty
813

9-
## 2.1.0
14+
## 2.1.0 (27/04/2017)
1015

1116
Features
1217
- Ability to record breadcrumbs in your code that will be sent to Raygun along with a raised exception ([#113](https://github.com/MindscapeHQ/raygun4ruby/pull/113))

lib/raygun/affected_user.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ class AffectedUser
1010
}.freeze
1111
SUPPORTED_ATTRIBUTES = DEFAULT_MAPPING.keys.freeze
1212
NAME_TO_RAYGUN_NAME_MAPPING = {
13-
identifier: :Identifier,
14-
email: :Email,
15-
full_name: :FullName,
16-
first_name: :FirstName,
17-
uuid: :UUID
13+
identifier: :identifier,
14+
email: :email,
15+
full_name: :fullName,
16+
first_name: :firstName,
17+
uuid: :uuid
1818
}.freeze
1919

2020
class << self
@@ -29,13 +29,13 @@ def information_hash(user_object)
2929
private
3030

3131
def handle_anonymous_user(user_object)
32-
result = { IsAnonymous: true }
33-
result[:Identifier] = user_object unless user_object.nil?
32+
result = { isAnonymous: true }
33+
result[:identifier] = user_object unless user_object.nil?
3434
result
3535
end
3636

3737
def handle_known_user(user_object)
38-
SUPPORTED_ATTRIBUTES.reduce({ IsAnonymous: false }) do |result, attribute|
38+
SUPPORTED_ATTRIBUTES.reduce({ isAnonymous: false }) do |result, attribute|
3939
mapping = Raygun.configuration.affected_user_mapping
4040
method = mapping[attribute]
4141

lib/raygun/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Raygun
2-
VERSION = "2.2.0"
2+
VERSION = "2.3.0"
33
end

test/unit/affected_user_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_inserting_user_object_with_email
6161
begin
6262
@middleware.call("action_controller.instance" => @controller)
6363
rescue TestException
64-
user_hash = { :Identifier => 123, :Email => "testemail@something.com", :IsAnonymous => false }
64+
user_hash = { :identifier => 123, :email => "testemail@something.com", :isAnonymous => false }
6565
assert_equal user_hash, @app.env["raygun.affected_user"]
6666
end
6767
end
@@ -77,7 +77,7 @@ def test_changing_method_mapping
7777
begin
7878
@middleware.call("action_controller.instance" => @controller)
7979
rescue TestException
80-
user_hash = { :Identifier => "topsecret", :IsAnonymous => false }
80+
user_hash = { :identifier => "topsecret", :isAnonymous => false }
8181
assert_equal user_hash, @app.env["raygun.affected_user"]
8282
end
8383
end
@@ -89,7 +89,7 @@ def test_inserting_user_as_plain_string
8989
begin
9090
@middleware.call("action_controller.instance" => @controller)
9191
rescue TestException
92-
user_hash = { :Identifier => "some-string-identifier", :IsAnonymous => true }
92+
user_hash = { :identifier => "some-string-identifier", :isAnonymous => true }
9393
assert_equal user_hash, @app.env["raygun.affected_user"]
9494
end
9595
end
@@ -101,7 +101,7 @@ def test_with_a_nil_user
101101
begin
102102
@middleware.call("action_controller.instance" => @controller)
103103
rescue TestException
104-
user_hash = { :IsAnonymous => true }
104+
user_hash = { :isAnonymous => true }
105105
assert_equal user_hash, @app.env["raygun.affected_user"]
106106
end
107107
end
@@ -113,7 +113,7 @@ def test_with_private_method
113113
begin
114114
@middleware.call("action_controller.instance" => @controller)
115115
rescue TestException
116-
user_hash = {:IsAnonymous=>false, :Identifier=>123, :Email=>"testemail@something.com"}
116+
user_hash = {:isAnonymous=>false, :identifier=>123, :email=>"testemail@something.com"}
117117
assert_equal user_hash, @app.env["raygun.affected_user"]
118118
end
119119
end
@@ -129,7 +129,7 @@ def test_with_proc_for_mapping
129129
begin
130130
@middleware.call("action_controller.instance" => @controller)
131131
rescue TestException
132-
user_hash = {:IsAnonymous=>false, :Identifier=>123, :Email=>"testemail@something.com", :FullName => "Taylor Lodge", :FirstName => "Taylor"}
132+
user_hash = {:isAnonymous=>false, :identifier=>123, :email=>"testemail@something.com", :fullName => "Taylor Lodge", :firstName => "Taylor"}
133133
assert_equal user_hash, @app.env["raygun.affected_user"]
134134
end
135135
end

test/unit/client_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,10 @@ def test_filter_payload_with_whitelist_request_specific_keys
634634
def test_build_payload_hash_adds_affected_user_details_when_supplied_with_user
635635
user = OpenStruct.new(id: '123', email: 'test@email.com', first_name: 'Taylor')
636636
expected_details = {
637-
:IsAnonymous => false,
638-
:Identifier => '123',
639-
:Email => 'test@email.com',
640-
:FirstName => 'Taylor',
637+
:isAnonymous => false,
638+
:identifier => '123',
639+
:email => 'test@email.com',
640+
:firstName => 'Taylor',
641641
}
642642

643643
user_details = @client.send(:build_payload_hash, test_exception, sample_env_hash, user)[:details][:user]

0 commit comments

Comments
 (0)