mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge branch 'jpa-backport-126' into jpa-backport-113
This commit is contained in:
commit
7a114937a7
2 changed files with 4 additions and 5 deletions
|
@ -55,6 +55,8 @@ module.exports = Router =
|
|||
app.post "/client/:client_id/disconnect", httpAuth, HttpApiController.disconnectClient
|
||||
|
||||
session.on 'connection', (error, client, session) ->
|
||||
# init client context, we may access it in Router._handleError before
|
||||
# setting any values
|
||||
client.ol_context = {}
|
||||
|
||||
client?.on "error", (err) ->
|
||||
|
@ -113,13 +115,9 @@ module.exports = Router =
|
|||
metrics.inc('socket-io.disconnect')
|
||||
metrics.gauge('socket-io.clients', io.sockets.clients()?.length - 1)
|
||||
|
||||
cleanup = () ->
|
||||
delete client.ol_context
|
||||
WebsocketController.leaveProject io, client, (err) ->
|
||||
if err?
|
||||
Router._handleError cleanup, err, client, "leaveProject"
|
||||
else
|
||||
cleanup()
|
||||
Router._handleError (() ->), err, client, "leaveProject"
|
||||
|
||||
# Variadic. The possible arguments:
|
||||
# doc_id, callback
|
||||
|
|
|
@ -33,6 +33,7 @@ module.exports = WebsocketController =
|
|||
logger.warn {err, project_id, user_id, client_id: client.id}, "user is not authorized to join project"
|
||||
return callback(err)
|
||||
|
||||
client.ol_context = {}
|
||||
client.ol_context["privilege_level"] = privilegeLevel
|
||||
client.ol_context["user_id"] = user_id
|
||||
client.ol_context["project_id"] = project_id
|
||||
|
|
Loading…
Reference in a new issue