mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Handle if user subscription field doesn't exists in telemetry func
Avoid null ref in the method when running Khoj server in anon mode
This commit is contained in:
@@ -72,7 +72,7 @@ def update_telemetry_state(
|
|||||||
metadata: Optional[dict] = None,
|
metadata: Optional[dict] = None,
|
||||||
):
|
):
|
||||||
user: KhojUser = request.user.object if request.user.is_authenticated else None
|
user: KhojUser = request.user.object if request.user.is_authenticated else None
|
||||||
subscription: Subscription = user.subscription if user and user.subscription else None
|
subscription: Subscription = user.subscription if user and hasattr(user, "subscription") else None
|
||||||
user_state = {
|
user_state = {
|
||||||
"client_host": request.client.host if request.client else None,
|
"client_host": request.client.host if request.client else None,
|
||||||
"user_agent": user_agent or "unknown",
|
"user_agent": user_agent or "unknown",
|
||||||
|
|||||||
Reference in New Issue
Block a user