@@ -129,7 +129,7 @@ class ProjectInfoContainer extends React.Component {
129129 const { duration } = this . state
130130 const { project, currentMemberRole, isSuperUser, phases, feeds,
131131 hideInfo, hideLinks, hideMembers, onChannelClick, activeChannelId, productsTimelines,
132- isManageUser, phasesTopics, isProjectPlan, isProjectProcessing } = this . props
132+ isManageUser, phasesTopics, isProjectPlan, isProjectProcessing, projectTemplates } = this . props
133133 let directLinks = null
134134 // check if direct links need to be added
135135 const isMemberOrCopilot = _ . indexOf ( [ PROJECT_ROLE_COPILOT , PROJECT_ROLE_MANAGER ] , currentMemberRole ) > - 1
@@ -206,6 +206,14 @@ class ProjectInfoContainer extends React.Component {
206206 } ) )
207207
208208 const attachmentsStorePath = `${ PROJECT_ATTACHMENTS_FOLDER } /${ project . id } /`
209+ let enableFileUpload = true
210+ if ( project . version !== 'v2' ) {
211+ const templateId = _ . get ( project , 'templateId' )
212+ const projectTemplate = _ . find ( projectTemplates , template => template . id === templateId )
213+ enableFileUpload = _ . some ( projectTemplate . scope . sections , section => {
214+ return _ . some ( section . subSections , subSection => subSection . id === 'files' )
215+ } )
216+ }
209217
210218 return (
211219 < div >
@@ -236,7 +244,7 @@ class ProjectInfoContainer extends React.Component {
236244 < FileLinksMenu
237245 links = { attachments }
238246 title = "Latest files"
239- canAdd
247+ canAdd = { enableFileUpload }
240248 onAddNewLink = { this . onAddFile }
241249 onAddAttachment = { this . onAddAttachment }
242250 moreText = "view all files"
@@ -276,6 +284,10 @@ ProjectInfoContainer.PropTypes = {
276284 isProjectProcessing : PropTypes . bool ,
277285}
278286
287+ const mapStateToProps = ( { templates } ) => ( {
288+ projectTemplates : templates . projectTemplates ,
289+ } )
290+
279291const mapDispatchToProps = { updateProject, deleteProject, addProjectAttachment, loadDashboardFeeds, loadPhaseFeed }
280292
281- export default connect ( null , mapDispatchToProps ) ( ProjectInfoContainer )
293+ export default connect ( mapStateToProps , mapDispatchToProps ) ( ProjectInfoContainer )
0 commit comments