mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 02:53:52 +00:00
sentry: Fix type error in add_context.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 71e1b3c91b)
This commit is contained in:
committed by
Tim Abbott
parent
3045cfaf22
commit
c11af3aae6
@@ -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/
|
# https://docs.sentry.io/platforms/python/guides/django/enriching-error-data/additional-data/identify-user/
|
||||||
event.setdefault("tags", {})
|
event.setdefault("tags", {})
|
||||||
user_info = event.get("user", {})
|
user_info = event.get("user", {})
|
||||||
if user_info.get("id"):
|
user_id = user_info.get("id")
|
||||||
user_profile = get_user_profile_by_id(user_info["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"
|
event["tags"]["realm"] = user_info["realm"] = user_profile.realm.string_id or "root"
|
||||||
with override_language(settings.LANGUAGE_CODE):
|
with override_language(settings.LANGUAGE_CODE):
|
||||||
# str() to force the lazy-translation to apply now,
|
# str() to force the lazy-translation to apply now,
|
||||||
|
|||||||
Reference in New Issue
Block a user