Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/projects/detail/containers/ProjectInfoContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 (
<div>
Expand Down Expand Up @@ -236,7 +244,7 @@ class ProjectInfoContainer extends React.Component {
<FileLinksMenu
links={attachments}
title="Latest files"
canAdd
canAdd={enableFileUpload}
onAddNewLink={this.onAddFile}
onAddAttachment={this.onAddAttachment}
moreText="view all files"
Expand Down Expand Up @@ -276,6 +284,10 @@ ProjectInfoContainer.PropTypes = {
isProjectProcessing: PropTypes.bool,
}

const mapStateToProps = ({templates }) => ({
projectTemplates : templates.projectTemplates,
})

const mapDispatchToProps = { updateProject, deleteProject, addProjectAttachment, loadDashboardFeeds, loadPhaseFeed }

export default connect(null, mapDispatchToProps)(ProjectInfoContainer)