Move Helpers/EmailHelpers to Helpers/EmailHelper

This commit is contained in:
Shane Kilkelly 2016-08-02 15:42:26 +01:00
parent 13fe000176
commit 2494026b85
4 changed files with 7 additions and 7 deletions

View file

@ -4,7 +4,7 @@ ProjectEditorHandler = require "../Project/ProjectEditorHandler"
EditorRealTimeController = require "../Editor/EditorRealTimeController"
LimitationsManager = require "../Subscription/LimitationsManager"
UserGetter = require "../User/UserGetter"
EmailHelpers = require "../Helpers/EmailHelpers"
EmailHelper = require "../Helpers/EmailHelper"
module.exports = CollaboratorsController =
@ -18,7 +18,7 @@ module.exports = CollaboratorsController =
else
{email, privileges} = req.body
email = EmailHelpers.parseEmail(email)
email = EmailHelper.parseEmail(email)
if !email? or email == ""
return res.status(400).send("invalid email address")

View file

@ -7,7 +7,7 @@ CollaboratorsEmailHandler = require "./CollaboratorsEmailHandler"
async = require "async"
PrivilegeLevels = require "../Authorization/PrivilegeLevels"
Errors = require "../Errors/Errors"
EmailHelpers = require "../Helpers/EmailHelpers"
EmailHelper = require "../Helpers/EmailHelper"
module.exports = CollaboratorsHandler =
@ -102,7 +102,7 @@ module.exports = CollaboratorsHandler =
async.series jobs, callback
addEmailToProject: (project_id, adding_user_id, unparsed_email, privilegeLevel, callback = (error, user) ->) ->
email = EmailHelpers.parseEmail(unparsed_email)
email = EmailHelper.parseEmail(unparsed_email)
if !email? or email == ""
return callback(new Error("no valid email provided: '#{unparsed_email}'"))
UserCreator.getUserOrCreateHoldingAccount email, (error, user) ->

View file

@ -4,7 +4,7 @@ UserGetter = require "../User/UserGetter"
Project = require("../../models/Project").Project
CollaboratorsInviteHandler = require('./CollaboratorsInviteHandler')
logger = require('logger-sharelatex')
EmailHelpers = require "../Helpers/EmailHelpers"
EmailHelper = require "../Helpers/EmailHelper"
module.exports = CollaboratorsInviteController =
@ -29,7 +29,7 @@ module.exports = CollaboratorsInviteController =
logger.log {projectId, email, sendingUserId}, "not allowed to invite more users to project"
return res.json {invite: null}
{email, privileges} = req.body
email = EmailHelpers.parseEmail(email)
email = EmailHelper.parseEmail(email)
if !email? or email == ""
logger.log {projectId, email, sendingUserId}, "invalid email address"
return res.sendStatus(400)

View file

@ -1,7 +1,7 @@
mimelib = require("mimelib")
module.exports = EmailHelpers =
module.exports = EmailHelper =
parseEmail: (email) ->
email = mimelib.parseAddresses(email or "")[0]?.address?.toLowerCase()