diff --git a/services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee b/services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee index 7bbfd78780..b089f943ce 100644 --- a/services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee +++ b/services/web/app/coffee/Features/Subscription/TeamInvitesHandler.coffee @@ -50,7 +50,9 @@ module.exports = TeamInvitesHandler = email = EmailHelper.parseEmail(user.email) return callback(new Error('invalid email')) if !email? logger.log {licence, email: email}, "Creating domain team invite" - inviterName = licence.name.replace(/\s+licence$/i, licence.name) + # If name == 'Uni of X License', make the email read only + # 'Uni of X has invited you...' + inviterName = licence.name.replace(/\s+(site\s+)?licence$/i, '') SubscriptionLocator.getSubscription licence.subscription_id, (error, subscription) -> return callback(error) if error? diff --git a/services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee b/services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee index e6f404516e..40cb18e41f 100644 --- a/services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee +++ b/services/web/test/unit/coffee/Subscription/TeamInvitesHandlerTests.coffee @@ -176,6 +176,27 @@ describe "TeamInvitesHandler", -> ).should.equal true done() + it "stripe licence from name", (done) -> + @licence.name = 'Foo Licence' + @TeamInvitesHandler.createDomainInvite @user, @licence, (err, invite) => + @EmailHandler.sendEmail.calledWith("verifyEmailToJoinTeam", + sinon.match({ + inviterName: 'Foo' + }) + ).should.equal true + done() + + + it "stripe site licence from name", (done) -> + @licence.name = 'Foo Site Licence' + @TeamInvitesHandler.createDomainInvite @user, @licence, (err, invite) => + @EmailHandler.sendEmail.calledWith("verifyEmailToJoinTeam", + sinon.match({ + inviterName: 'Foo' + }) + ).should.equal true + done() + describe "importInvite", -> beforeEach -> @sentAt = new Date()