Merge pull request #77 from overleaf/bg-minimal-connected-users-fix

only show connected users with a user_id
This commit is contained in:
Brian Gough 2019-08-16 10:47:58 +01:00 committed by GitHub
commit 59886a980b
3 changed files with 3 additions and 2 deletions

View file

@ -60,7 +60,7 @@ module.exports =
_getConnectedUser: (project_id, client_id, callback)->
rclient.hgetall Keys.connectedUser({project_id, client_id}), (err, result)->
if !result? or Object.keys(result).length == 0
if !result? or Object.keys(result).length == 0 or !result.user_id
result =
connected : false
client_id:client_id

View file

@ -124,7 +124,7 @@ describe "ConnectedUsersManager", ->
it "should return a connected user if there is a user object", (done)->
cursorData = JSON.stringify(cursorData:{row:1})
@rClient.hgetall.callsArgWith(1, null, {connected_at:new Date(), cursorData})
@rClient.hgetall.callsArgWith(1, null, {connected_at:new Date(), user_id: @user._id, last_updated_at: "#{Date.now()}", cursorData})
@ConnectedUsersManager._getConnectedUser @project_id, @client_id, (err, result)=>
result.connected.should.equal true
result.client_id.should.equal @client_id

View file

@ -17,6 +17,7 @@ describe "WebsocketLoadBalancer", ->
"./HealthCheckManager": {check: sinon.stub()}
"./RoomManager" : @RoomManager = {eventSource: sinon.stub().returns @RoomEvents}
"./ChannelManager": @ChannelManager = {publish: sinon.stub()}
"./ConnectedUsersManager": @ConnectedUsersManager = {refreshClient: sinon.stub()}
@io = {}
@WebsocketLoadBalancer.rclientPubList = [{publish: sinon.stub()}]
@WebsocketLoadBalancer.rclientSubList = [{