Add contact when adding collaborator
This commit is contained in:
@@ -19,6 +19,7 @@ describe "CollaboratorsController", ->
|
||||
"../Editor/EditorRealTimeController": @EditorRealTimeController = {}
|
||||
'../Subscription/LimitationsManager' : @LimitationsManager = {}
|
||||
'../Project/ProjectEditorHandler' : @ProjectEditorHandler = {}
|
||||
"../Contacts/ContactManager": @ContactManager = {}
|
||||
@res = new MockResponse()
|
||||
@req = new MockRequest()
|
||||
|
||||
@@ -61,6 +62,8 @@ describe "CollaboratorsController", ->
|
||||
@req.body =
|
||||
email: @email = "Joe@example.com"
|
||||
privileges: @privileges = "readOnly"
|
||||
@req.session =
|
||||
user: _id: @adding_user_id = "adding-user-id"
|
||||
@res.json = sinon.stub()
|
||||
@user_id = "mock-user-id"
|
||||
@raw_user = {
|
||||
@@ -75,6 +78,7 @@ describe "CollaboratorsController", ->
|
||||
@UserGetter.getUser = sinon.stub().callsArgWith(1, null, @user)
|
||||
@CollaboratorsEmailHandler.notifyUserOfProjectShare = sinon.stub()
|
||||
@EditorRealTimeController.emitToRoom = sinon.stub()
|
||||
@ContactManager.addContact = sinon.stub()
|
||||
@callback = sinon.stub()
|
||||
|
||||
describe "when the project can accept more collaborators", ->
|
||||
@@ -95,6 +99,11 @@ describe "CollaboratorsController", ->
|
||||
@CollaboratorsEmailHandler.notifyUserOfProjectShare
|
||||
.calledWith(@project_id, @email.toLowerCase())
|
||||
.should.equal true
|
||||
|
||||
it "should add the user as a contact for the adding user", ->
|
||||
@ContactManager.addContact
|
||||
.calledWith(@adding_user_id, @user_id)
|
||||
.should.equal true
|
||||
|
||||
it "should send the user as the response body", ->
|
||||
@res.json
|
||||
|
||||
Reference in New Issue
Block a user