From 0dbd3501a3843a27a6e05568bfae067482f41ce0 Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Thu, 20 Dec 2018 12:51:59 +0530 Subject: [PATCH] Allowing upload of files only if files subSection is present in template, this change is done specific to CS forms only --- .../detail/containers/ProjectInfoContainer.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/projects/detail/containers/ProjectInfoContainer.js b/src/projects/detail/containers/ProjectInfoContainer.js index 9b89647e3..715c3a8bd 100644 --- a/src/projects/detail/containers/ProjectInfoContainer.js +++ b/src/projects/detail/containers/ProjectInfoContainer.js @@ -129,7 +129,7 @@ class ProjectInfoContainer extends React.Component { const { duration } = this.state const { project, currentMemberRole, isSuperUser, phases, feeds, hideInfo, hideLinks, hideMembers, onChannelClick, activeChannelId, productsTimelines, - isManageUser, phasesTopics, isProjectPlan, isProjectProcessing } = this.props + isManageUser, phasesTopics, isProjectPlan, isProjectProcessing, projectTemplates } = this.props let directLinks = null // check if direct links need to be added const isMemberOrCopilot = _.indexOf([PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER], currentMemberRole) > -1 @@ -206,6 +206,14 @@ class ProjectInfoContainer extends React.Component { })) const attachmentsStorePath = `${PROJECT_ATTACHMENTS_FOLDER}/${project.id}/` + let enableFileUpload = true + if(project.version !== 'v2') { + const templateId = _.get(project, 'templateId') + const projectTemplate = _.find(projectTemplates, template => template.id === templateId) + enableFileUpload = _.some(projectTemplate.scope.sections, section => { + return _.some(section.subSections, subSection => subSection.id === 'files') + }) + } return (
@@ -236,7 +244,7 @@ class ProjectInfoContainer extends React.Component { ({ + projectTemplates : templates.projectTemplates, +}) + const mapDispatchToProps = { updateProject, deleteProject, addProjectAttachment, loadDashboardFeeds, loadPhaseFeed } -export default connect(null, mapDispatchToProps)(ProjectInfoContainer) +export default connect(mapStateToProps, mapDispatchToProps)(ProjectInfoContainer)