mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
Make request._client a public member, dropping the '_'.
(imported from commit 5fc7ab57157ceb40c8bca9b0c97a47d8fac6745b)
This commit is contained in:
@@ -73,7 +73,7 @@ def authenticated_api_view(view_func):
|
|||||||
return json_error("Invalid user: %s" % (email,))
|
return json_error("Invalid user: %s" % (email,))
|
||||||
if api_key != user_profile.api_key:
|
if api_key != user_profile.api_key:
|
||||||
return json_error("Invalid API key for user '%s'" % (email,))
|
return json_error("Invalid API key for user '%s'" % (email,))
|
||||||
request._client = client
|
request.client = client
|
||||||
request._email = email
|
request._email = email
|
||||||
update_user_activity(request, user_profile)
|
update_user_activity(request, user_profile)
|
||||||
return view_func(request, user_profile, *args, **kwargs)
|
return view_func(request, user_profile, *args, **kwargs)
|
||||||
@@ -82,7 +82,7 @@ def authenticated_api_view(view_func):
|
|||||||
def authenticate_log_and_execute_json(request, client, view_func, *args, **kwargs):
|
def authenticate_log_and_execute_json(request, client, view_func, *args, **kwargs):
|
||||||
if not request.user.is_authenticated():
|
if not request.user.is_authenticated():
|
||||||
return json_error("Not logged in", status=401)
|
return json_error("Not logged in", status=401)
|
||||||
request._client = client
|
request.client = client
|
||||||
user_profile = get_user_profile_by_user_id(request.user.id)
|
user_profile = get_user_profile_by_user_id(request.user.id)
|
||||||
request._email = user_profile.user.email
|
request._email = user_profile.user.email
|
||||||
update_user_activity(request, user_profile)
|
update_user_activity(request, user_profile)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class LogRequests(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
email = "unauth"
|
email = "unauth"
|
||||||
try:
|
try:
|
||||||
client = request._client.name
|
client = request.client.name
|
||||||
except Exception:
|
except Exception:
|
||||||
client = "?"
|
client = "?"
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ def notify(request):
|
|||||||
def json_get_updates(request, user_profile, handler):
|
def json_get_updates(request, user_profile, handler):
|
||||||
client_id = request.session.session_key
|
client_id = request.session.session_key
|
||||||
return get_updates_backend(request, user_profile, handler, client_id,
|
return get_updates_backend(request, user_profile, handler, client_id,
|
||||||
client=request._client, apply_markdown=True)
|
client=request.client, apply_markdown=True)
|
||||||
|
|
||||||
@asynchronous
|
@asynchronous
|
||||||
@authenticated_api_view
|
@authenticated_api_view
|
||||||
@@ -40,7 +40,7 @@ def api_get_messages(request, user_profile, handler, client_id=POST(default=None
|
|||||||
apply_markdown=POST(default=False, converter=json_to_bool)):
|
apply_markdown=POST(default=False, converter=json_to_bool)):
|
||||||
return get_updates_backend(request, user_profile, handler, client_id,
|
return get_updates_backend(request, user_profile, handler, client_id,
|
||||||
apply_markdown=apply_markdown,
|
apply_markdown=apply_markdown,
|
||||||
client=request._client)
|
client=request.client)
|
||||||
|
|
||||||
def format_updates_response(messages=[], apply_markdown=True,
|
def format_updates_response(messages=[], apply_markdown=True,
|
||||||
user_profile=None, new_pointer=None,
|
user_profile=None, new_pointer=None,
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ def update_pointer_backend(request, user_profile,
|
|||||||
user_profile.pointer = pointer
|
user_profile.pointer = pointer
|
||||||
user_profile.save(update_fields=["pointer"])
|
user_profile.save(update_fields=["pointer"])
|
||||||
|
|
||||||
if request._client.name.lower() in ['android', 'iphone']:
|
if request.client.name.lower() in ['android', 'iphone']:
|
||||||
# TODO (leo)
|
# TODO (leo)
|
||||||
# Until we handle the new read counts in the mobile apps natively,
|
# Until we handle the new read counts in the mobile apps natively,
|
||||||
# this is a shim that will mark as read any messages up until the
|
# this is a shim that will mark as read any messages up until the
|
||||||
@@ -1309,7 +1309,7 @@ def json_update_active_status(request, user_profile,
|
|||||||
else:
|
else:
|
||||||
raise JsonableError("Invalid presence status: %s" % (status,))
|
raise JsonableError("Invalid presence status: %s" % (status,))
|
||||||
|
|
||||||
update_user_presence(user_profile, request._client, now(), status_val)
|
update_user_presence(user_profile, request.client, now(), status_val)
|
||||||
|
|
||||||
ret = get_status_list(user_profile)
|
ret = get_status_list(user_profile)
|
||||||
if user_profile.realm.domain == "mit.edu":
|
if user_profile.realm.domain == "mit.edu":
|
||||||
|
|||||||
Reference in New Issue
Block a user