Refresh members and invites in client when status changes

This commit is contained in:
Shane Kilkelly
2016-08-05 14:01:08 +01:00
parent 8f7603c324
commit eafd61a90e
6 changed files with 42 additions and 8 deletions
@@ -128,6 +128,9 @@ describe "CollaboratorsController", ->
it "should send the back a success response", ->
@res.sendStatus.calledWith(204).should.equal true
it 'should have called emitToRoom', ->
@EditorRealTimeController.emitToRoom.calledWith(@project_id, 'project:membership:changed').should.equal true
describe "removeSelfFromProject", ->
beforeEach ->
@req.session =
@@ -22,6 +22,7 @@ describe "CollaboratorsInviteController", ->
"./CollaboratorsHandler": @CollaboratorsHandler = {}
"./CollaboratorsInviteHandler": @CollaboratorsInviteHandler = {}
'logger-sharelatex': @logger = {err: sinon.stub(), error: sinon.stub(), log: sinon.stub()}
"../Editor/EditorRealTimeController": @EditorRealTimeController = {emitToRoom: sinon.stub()}
@res = new MockResponse()
@req = new MockRequest()
@@ -112,6 +113,10 @@ describe "CollaboratorsInviteController", ->
@CollaboratorsInviteHandler.inviteToProject.callCount.should.equal 1
@CollaboratorsInviteHandler.inviteToProject.calledWith(@project_id,@current_user_id,@targetEmail,@privileges).should.equal true
it 'should have called emitToRoom', ->
@EditorRealTimeController.emitToRoom.callCount.should.equal 1
@EditorRealTimeController.emitToRoom.calledWith(@project_id, 'project:membership:changed').should.equal true
describe 'when the user is not allowed to add more collaborators', ->
beforeEach ->
@@ -499,6 +504,10 @@ describe "CollaboratorsInviteController", ->
it 'should have called revokeInvite', ->
@CollaboratorsInviteHandler.revokeInvite.callCount.should.equal 1
it 'should have called emitToRoom', ->
@EditorRealTimeController.emitToRoom.callCount.should.equal 1
@EditorRealTimeController.emitToRoom.calledWith(@project_id, 'project:membership:changed').should.equal true
describe 'when revokeInvite produces an error', ->
beforeEach ->
@@ -544,6 +553,10 @@ describe "CollaboratorsInviteController", ->
it 'should have called acceptInvite', ->
@CollaboratorsInviteHandler.acceptInvite.callCount.should.equal 1
it 'should have called emitToRoom', ->
@EditorRealTimeController.emitToRoom.callCount.should.equal 1
@EditorRealTimeController.emitToRoom.calledWith(@project_id, 'project:membership:changed').should.equal true
describe 'when revokeInvite produces an error', ->
beforeEach ->