From 467b0d3c8da93f38c440c78278e11f3b2d1d30c0 Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Wed, 19 Dec 2018 16:24:44 +0530 Subject: [PATCH 1/2] Allowing upload of files only if files subSection is present in template --- .../detail/containers/ProjectInfoContainer.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/projects/detail/containers/ProjectInfoContainer.js b/src/projects/detail/containers/ProjectInfoContainer.js index 9b89647e3..33dd834ab 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,11 @@ class ProjectInfoContainer extends React.Component { })) const attachmentsStorePath = `${PROJECT_ATTACHMENTS_FOLDER}/${project.id}/` + const templateId = _.get(project, 'templateId') + const projectTemplate = _.find(projectTemplates, pt => pt.id === templateId) + const subSectionsTemplate = projectTemplate.scope.sections[0].subSections + //Allowing upload of files only if files subSection is present in template + const shouldUploadFiles = _.find(subSectionsTemplate, st => st.id === 'files') ? true : false return (
@@ -236,7 +241,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) From 712e01561e8f7f7af9baa22e967834b197bcb919 Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Wed, 19 Dec 2018 17:35:55 +0530 Subject: [PATCH 2/2] lint --- src/projects/detail/containers/ProjectInfoContainer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/projects/detail/containers/ProjectInfoContainer.js b/src/projects/detail/containers/ProjectInfoContainer.js index 33dd834ab..e4a99db15 100644 --- a/src/projects/detail/containers/ProjectInfoContainer.js +++ b/src/projects/detail/containers/ProjectInfoContainer.js @@ -210,7 +210,7 @@ class ProjectInfoContainer extends React.Component { const projectTemplate = _.find(projectTemplates, pt => pt.id === templateId) const subSectionsTemplate = projectTemplate.scope.sections[0].subSections //Allowing upload of files only if files subSection is present in template - const shouldUploadFiles = _.find(subSectionsTemplate, st => st.id === 'files') ? true : false + const shouldUploadFiles = _.some(subSectionsTemplate, st => st.id === 'files') return (