take custom first and last names from export UI

This commit is contained in:
hugh-obrien 2018-06-04 11:05:47 +01:00
parent 63482e0ea0
commit 4c5f186ca2
2 changed files with 21 additions and 4 deletions

View file

@ -7,7 +7,17 @@ module.exports =
exportProject: (req, res) -> exportProject: (req, res) ->
{project_id, brand_variation_id} = req.params {project_id, brand_variation_id} = req.params
user_id = AuthenticationController.getLoggedInUserId(req) user_id = AuthenticationController.getLoggedInUserId(req)
ExportsHandler.exportProject project_id, user_id, brand_variation_id, (err, export_data) -> export_params = {
project_id: project_id,
brand_variation_id: brand_variation_id,
user_id: user_id
}
if req.body && req.body.firstName && req.body.firstName
export_params.first_name = req.body.firstName
export_params.last_name = req.body.lastName
ExportsHandler.exportProject export_params, (err, export_data) ->
return next(err) if err? return next(err) if err?
logger.log logger.log
user_id:user_id user_id:user_id

View file

@ -10,8 +10,8 @@ settings = require 'settings-sharelatex'
module.exports = ExportsHandler = self = module.exports = ExportsHandler = self =
exportProject: (project_id, user_id, brand_variation_id, callback=(error, export_data) ->) -> exportProject: (export_params, callback=(error, export_data) ->) ->
self._buildExport project_id, user_id, brand_variation_id, (err, export_data) -> self._buildExport export_params, (err, export_data) ->
return callback(err) if err? return callback(err) if err?
self._requestExport export_data, (err, export_v1_id) -> self._requestExport export_data, (err, export_v1_id) ->
return callback(err) if err? return callback(err) if err?
@ -19,7 +19,10 @@ module.exports = ExportsHandler = self =
# TODO: possibly store the export data in Mongo # TODO: possibly store the export data in Mongo
callback null, export_data callback null, export_data
_buildExport: (project_id, user_id, brand_variation_id, callback=(err, export_data) ->) -> _buildExport: (export_params, callback=(err, export_data) ->) ->
project_id = export_params.project_id
user_id = export_params.user_id
brand_variation_id = export_params.brand_variation_id
jobs = jobs =
project: (cb) -> project: (cb) ->
ProjectGetter.getProject project_id, cb ProjectGetter.getProject project_id, cb
@ -43,6 +46,10 @@ module.exports = ExportsHandler = self =
logger.err err:err, project_id: project_id logger.err err:err, project_id: project_id
return callback(err) return callback(err)
if export_params.first_name && export_params.last_name
user.first_name = export_params.first_name
user.last_name = export_params.last_name
export_data = export_data =
project: project:
id: project_id id: project_id