mirror of https://github.com/zulip/zulip.git
Replace /json/update_active_status with REST style route.
This commit is contained in:
parent
6356584f84
commit
a12006d86f
|
@ -353,7 +353,7 @@ exports._status_from_timestamp = status_from_timestamp;
|
|||
|
||||
function focus_ping() {
|
||||
channel.post({
|
||||
url: '/json/update_active_status',
|
||||
url: '/json/users/me/presence',
|
||||
data: {status: (exports.has_focus) ? exports.ACTIVE : exports.IDLE,
|
||||
new_user_input: exports.new_user_input},
|
||||
idempotent: true,
|
||||
|
|
|
@ -75,7 +75,7 @@ class ZulipSession extends Session
|
|||
message_latency.update(+new Date() - parseInt(m[1], 10))
|
||||
|
||||
update_active_status: ->
|
||||
@post "/json/update_active_status", {status: "active"}, update_status_time.cbTimer()
|
||||
@post "/json/users/me/presence", {status: "active"}, update_status_time.cbTimer()
|
||||
|
||||
send_stream_message: (stream, subject, content) ->
|
||||
@post '/json/messages', {
|
||||
|
|
|
@ -55,7 +55,7 @@ def asynchronous(method):
|
|||
def update_user_activity(request, user_profile):
|
||||
# update_active_status also pushes to rabbitmq, and it seems
|
||||
# redundant to log that here as well.
|
||||
if request.META["PATH_INFO"] == '/json/update_active_status':
|
||||
if request.META["PATH_INFO"] == '/json/users/me/presence':
|
||||
return
|
||||
|
||||
if hasattr(request, '_query'):
|
||||
|
|
|
@ -1141,7 +1141,7 @@ class UserPresenceTests(AuthedTestCase):
|
|||
self.assertEqual(list(json['presences'].keys()), ['hamlet@zulip.com'])
|
||||
return json['presences'][email][client]['timestamp']
|
||||
|
||||
result = self.client.post("/json/update_active_status", {'status': 'idle'})
|
||||
result = self.client.post("/json/users/me/presence", {'status': 'idle'})
|
||||
test_result(result)
|
||||
|
||||
result = self.client.post("/json/get_active_statuses", {})
|
||||
|
@ -1149,7 +1149,7 @@ class UserPresenceTests(AuthedTestCase):
|
|||
|
||||
email = "othello@zulip.com"
|
||||
self.login(email)
|
||||
self.client.post("/json/update_active_status", {'status': 'idle'})
|
||||
self.client.post("/json/users/me/presence", {'status': 'idle'})
|
||||
result = self.client.post("/json/get_active_statuses", {})
|
||||
self.assert_json_success(result)
|
||||
json = ujson.loads(result.content)
|
||||
|
@ -1163,7 +1163,7 @@ class UserPresenceTests(AuthedTestCase):
|
|||
self.login("hamlet@zulip.com")
|
||||
client = 'website'
|
||||
|
||||
self.client.post("/json/update_active_status", {'status': 'idle'})
|
||||
self.client.post("/json/users/me/presence", {'status': 'idle'})
|
||||
result = self.client.post("/json/get_active_statuses", {})
|
||||
|
||||
self.assert_json_success(result)
|
||||
|
@ -1172,14 +1172,14 @@ class UserPresenceTests(AuthedTestCase):
|
|||
|
||||
email = "othello@zulip.com"
|
||||
self.login("othello@zulip.com")
|
||||
self.client.post("/json/update_active_status", {'status': 'idle'})
|
||||
self.client.post("/json/users/me/presence", {'status': 'idle'})
|
||||
result = self.client.post("/json/get_active_statuses", {})
|
||||
self.assert_json_success(result)
|
||||
json = ujson.loads(result.content)
|
||||
self.assertEqual(json['presences'][email][client]['status'], 'idle')
|
||||
self.assertEqual(json['presences']['hamlet@zulip.com'][client]['status'], 'idle')
|
||||
|
||||
self.client.post("/json/update_active_status", {'status': 'active'})
|
||||
self.client.post("/json/users/me/presence", {'status': 'active'})
|
||||
result = self.client.post("/json/get_active_statuses", {})
|
||||
self.assert_json_success(result)
|
||||
json = ujson.loads(result.content)
|
||||
|
@ -1189,19 +1189,19 @@ class UserPresenceTests(AuthedTestCase):
|
|||
def test_no_mit(self):
|
||||
# MIT never gets a list of users
|
||||
self.login("espuser@mit.edu")
|
||||
result = self.client.post("/json/update_active_status", {'status': 'idle'})
|
||||
result = self.client.post("/json/users/me/presence", {'status': 'idle'})
|
||||
self.assert_json_success(result)
|
||||
json = ujson.loads(result.content)
|
||||
self.assertEqual(json['presences'], {})
|
||||
|
||||
def test_same_realm(self):
|
||||
self.login("espuser@mit.edu")
|
||||
self.client.post("/json/update_active_status", {'status': 'idle'})
|
||||
self.client.post("/json/users/me/presence", {'status': 'idle'})
|
||||
result = self.client.post("/accounts/logout/")
|
||||
|
||||
# Ensure we don't see hamlet@zulip.com information leakage
|
||||
self.login("hamlet@zulip.com")
|
||||
result = self.client.post("/json/update_active_status", {'status': 'idle'})
|
||||
result = self.client.post("/json/users/me/presence", {'status': 'idle'})
|
||||
self.assert_json_success(result)
|
||||
json = ujson.loads(result.content)
|
||||
self.assertEqual(json['presences']["hamlet@zulip.com"]["website"]['status'], 'idle')
|
||||
|
|
Loading…
Reference in New Issue