diff --git a/services/web/app/coffee/Features/Collaborators/CollaboratorsHandler.coffee b/services/web/app/coffee/Features/Collaborators/CollaboratorsHandler.coffee index 6fd9e4b1be..af3a85dd07 100644 --- a/services/web/app/coffee/Features/Collaborators/CollaboratorsHandler.coffee +++ b/services/web/app/coffee/Features/Collaborators/CollaboratorsHandler.coffee @@ -89,13 +89,13 @@ module.exports = CollaboratorsHandler = return callback null, member.privilegeLevel return callback null, PrivilegeLevels.NONE - getMemberCount: (project_id, callback = (error, count) ->) -> + getInvitedMemberCount: (project_id, callback = (error, count) ->) -> CollaboratorsHandler.getMemberIdsWithPrivilegeLevels project_id, (error, members) -> return callback(error) if error? - return callback null, (members or []).length + return callback null, (members or []).filter((m) -> m.source == Sources.INVITE).length - getCollaboratorCount: (project_id, callback = (error, count) ->) -> - CollaboratorsHandler.getMemberCount project_id, (error, count) -> + getInvitedCollaboratorCount: (project_id, callback = (error, count) ->) -> + CollaboratorsHandler.getInvitedMemberCount project_id, (error, count) -> return callback(error) if error? return callback null, count - 1 # Don't count project owner diff --git a/services/web/app/coffee/Features/Subscription/LimitationsManager.coffee b/services/web/app/coffee/Features/Subscription/LimitationsManager.coffee index 4d85ccec47..5d90fed9f3 100644 --- a/services/web/app/coffee/Features/Subscription/LimitationsManager.coffee +++ b/services/web/app/coffee/Features/Subscription/LimitationsManager.coffee @@ -24,7 +24,7 @@ module.exports = canAddXCollaborators: (project_id, x_collaborators, callback = (error, allowed)->) -> @allowedNumberOfCollaboratorsInProject project_id, (error, allowed_number) => return callback(error) if error? - CollaboratorsHandler.getCollaboratorCount project_id, (error, current_number) => + CollaboratorsHandler.getInvitedCollaboratorCount project_id, (error, current_number) => return callback(error) if error? CollaboratorsInvitesHandler.getInviteCount project_id, (error, invite_count) => return callback(error) if error? diff --git a/services/web/test/UnitTests/coffee/Subscription/LimitationsManagerTests.coffee b/services/web/test/UnitTests/coffee/Subscription/LimitationsManagerTests.coffee index a26b2c7a75..ea7403bef7 100644 --- a/services/web/test/UnitTests/coffee/Subscription/LimitationsManagerTests.coffee +++ b/services/web/test/UnitTests/coffee/Subscription/LimitationsManagerTests.coffee @@ -79,7 +79,7 @@ describe "LimitationsManager", -> describe "canAddXCollaborators", -> beforeEach -> - @CollaboratorsHandler.getCollaboratorCount = (project_id, callback) => callback(null, @current_number) + @CollaboratorsHandler.getInvitedCollaboratorCount = (project_id, callback) => callback(null, @current_number) @CollaboratorsInviteHandler.getInviteCount = (project_id, callback) => callback(null, @invite_count) sinon.stub @LimitationsManager, "allowedNumberOfCollaboratorsInProject",