From da616a5a4da81a66c0ad9d6fcdebf3b442981cb0 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Thu, 10 Aug 2017 09:25:43 +0530 Subject: [PATCH] =?UTF-8?q?Github=20issue#1102,=20Process/add=20ref=20code?= =?UTF-8?q?=20from=20deep=20link=20=E2=80=94=20Truncated=20the=20ref=20cod?= =?UTF-8?q?e=20to=207=20characters=20only=20=E2=80=94=20ref=20code=20=3D>?= =?UTF-8?q?=20refCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/projects/create/components/ProjectWizard.jsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/projects/create/components/ProjectWizard.jsx b/src/projects/create/components/ProjectWizard.jsx index 9cd6db2ba..9f1c885f2 100644 --- a/src/projects/create/components/ProjectWizard.jsx +++ b/src/projects/create/components/ProjectWizard.jsx @@ -8,7 +8,7 @@ import SelectProduct from './SelectProduct' import IncompleteProjectConfirmation from './IncompleteProjectConfirmation' import FillProjectDetails from './FillProjectDetails' import update from 'react-addons-update' -import { LS_INCOMPLETE_PROJECT } from '../../../config/constants' +import { LS_INCOMPLETE_PROJECT, PROJECT_REF_CODE_MAX_LENGTH } from '../../../config/constants' import './ProjectWizard.scss' const WZ_STEP_INCOMP_PROJ_CONF = 0 @@ -65,14 +65,15 @@ class ProjectWizard extends Component { wizardStep = WZ_STEP_FILL_PROJ_DETAILS } } - // retrieve refcode from query param - const refcode = _.get(location, 'query.refcode') - if (refcode) { - // if refcode exists, update the updateQuery to set that refcode + // retrieve refCode from query param + // TODO give warning after truncating + const refCode = _.get(location, 'query.refCode', '').trim().substr(0, PROJECT_REF_CODE_MAX_LENGTH) + if (refCode.trim().length > 0) { + // if refCode exists, update the updateQuery to set that refCode if (_.get(updateQuery, 'details')) { - updateQuery['details']['utm'] = { $set : { code : refcode }} + updateQuery['details']['utm'] = { $set : { code : refCode }} } else { - updateQuery['details'] = { utm : { $set : { code : refcode }}} + updateQuery['details'] = { utm : { $set : { code : refCode }}} } } this.setState({