Skip to content

Commit

Permalink
user_ident
Browse files Browse the repository at this point in the history
  • Loading branch information
NisanthanNanthakumar committed Nov 9, 2023
1 parent 87c07ac commit c2a8110
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/sentry/utils/eventuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EventUser:
username: Optional[str]
name: Optional[str]
ip_address: Optional[str]
user_id: Optional[int]
user_ident: Optional[int]
id: Optional[int] = None # EventUser model id

@staticmethod
Expand All @@ -47,7 +47,7 @@ def from_event(event: Event) -> EventUser:
username=event.data.get("user", {}).get("username") if event else None,
name=event.data.get("user", {}).get("name") if event else None,
ip_address=event.data.get("user", {}).get("ip_address") if event else None,
user_id=event.data.get("user", {}).get("id") if event else None,
user_ident=event.data.get("user", {}).get("id") if event else None,
)

def get_display_name(self):
Expand Down Expand Up @@ -116,21 +116,21 @@ def from_snuba(result: Mapping[str, Any]) -> EventUser:
Converts the object from the Snuba query into an EventUser instance
"""
return EventUser(
id=result.get("user_id"),
id=None,
project_id=result.get("project_id"),
email=result.get("user_email"),
username=result.get("user_name"),
name=result.get("user_name"),
ip_address=result.get("ip_address_4") or result.get("ip_address_6"),
user_id=result.get("user_id"),
user_ident=result.get("user_id"),
)

@property
def tag_value(self) -> str:
"""
Return the identifier to link this user.
"""
return f"id:{self.user_id}"
return f"id:{self.user_ident}"

def serialize(self):
return {
Expand Down

0 comments on commit c2a8110

Please sign in to comment.