Merge pull request #893 from sharelatex/ja-fix-duplicate-text-in-email

Don't include the license name twice in invite emails
This commit is contained in:
Brian Gough 2018-09-28 11:15:40 +01:00 committed by GitHub
commit 6d5908f2f4
2 changed files with 24 additions and 1 deletions

View file

@ -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?

View file

@ -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()