From 5d5bd87ff509912fda4d35db26adee1e502a2cc2 Mon Sep 17 00:00:00 2001 From: vikasrohit Date: Wed, 19 Dec 2018 21:40:33 +0530 Subject: [PATCH 1/3] Revert "Allowing upload of files only if files subSection is present in template" --- .../detail/containers/ProjectInfoContainer.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/projects/detail/containers/ProjectInfoContainer.js b/src/projects/detail/containers/ProjectInfoContainer.js index e4a99db15..9b89647e3 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, projectTemplates } = this.props + isManageUser, phasesTopics, isProjectPlan, isProjectProcessing } = 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,11 +206,6 @@ 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 = _.some(subSectionsTemplate, st => st.id === 'files') return (
@@ -241,7 +236,7 @@ class ProjectInfoContainer extends React.Component { ({ - projectTemplates : templates.projectTemplates, -}) const mapDispatchToProps = { updateProject, deleteProject, addProjectAttachment, loadDashboardFeeds, loadPhaseFeed } -export default connect(mapStateToProps, mapDispatchToProps)(ProjectInfoContainer) +export default connect(null, mapDispatchToProps)(ProjectInfoContainer) From 1bd2fd3216608ae7d02777304756488fc46eeaac Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Thu, 20 Dec 2018 11:35:43 +0530 Subject: [PATCH 2/3] CS-Enabled file upload only for Managers --- .../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..96c19dcfa 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) From 93348b24c83fec6fca880d2113991b770e7dafb8 Mon Sep 17 00:00:00 2001 From: RishiRaj Date: Thu, 20 Dec 2018 11:40:03 +0530 Subject: [PATCH 3/3] 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 96c19dcfa..715c3a8bd 100644 --- a/src/projects/detail/containers/ProjectInfoContainer.js +++ b/src/projects/detail/containers/ProjectInfoContainer.js @@ -207,7 +207,7 @@ class ProjectInfoContainer extends React.Component { const attachmentsStorePath = `${PROJECT_ATTACHMENTS_FOLDER}/${project.id}/` let enableFileUpload = true - if(project.version != 'v2') { + if(project.version !== 'v2') { const templateId = _.get(project, 'templateId') const projectTemplate = _.find(projectTemplates, template => template.id === templateId) enableFileUpload = _.some(projectTemplate.scope.sections, section => {