mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	sentry: Fix type error in add_context.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							eb622bae0a
						
					
				
				
					commit
					71e1b3c91b
				
			@@ -32,8 +32,9 @@ def add_context(event: "Event", hint: "Hint") -> Optional["Event"]:
 | 
			
		||||
        # https://docs.sentry.io/platforms/python/guides/django/enriching-error-data/additional-data/identify-user/
 | 
			
		||||
        event.setdefault("tags", {})
 | 
			
		||||
        user_info = event.get("user", {})
 | 
			
		||||
        if user_info.get("id"):
 | 
			
		||||
            user_profile = get_user_profile_by_id(user_info["id"])
 | 
			
		||||
        user_id = user_info.get("id")
 | 
			
		||||
        if isinstance(user_id, str):
 | 
			
		||||
            user_profile = get_user_profile_by_id(int(user_id))
 | 
			
		||||
            event["tags"]["realm"] = user_info["realm"] = user_profile.realm.string_id or "root"
 | 
			
		||||
            with override_language(settings.LANGUAGE_CODE):
 | 
			
		||||
                # str() to force the lazy-translation to apply now,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user