@@ -82,7 +82,7 @@ class ProjectInfoContainer extends React.Component {
8282
8383 render ( ) {
8484 const { duration } = this . state
85- const { project, currentMemberRole, isSuperUser } = this . props
85+ const { project, phases , currentMemberRole, isSuperUser } = this . props
8686 let directLinks = null
8787 // check if direct links need to be added
8888 const isMemberOrCopilot = _ . indexOf ( [ PROJECT_ROLE_COPILOT , PROJECT_ROLE_MANAGER ] , currentMemberRole ) > - 1
@@ -107,7 +107,20 @@ class ProjectInfoContainer extends React.Component {
107107 devices = _ . get ( project , 'details.devices' , [ ] )
108108 }
109109
110- const attachments = _ . sortBy ( project . attachments , attachment => - new Date ( attachment . updatedAt ) . getTime ( ) )
110+ let attachments = project . attachments
111+ // merges the product attachments to show in the links menu
112+ if ( phases && phases . length > 0 ) {
113+ phases . forEach ( phase => {
114+ if ( phase . products && phase . products . length > 0 ) {
115+ phase . products . forEach ( product => {
116+ if ( product . attachments && product . attachments . length > 0 ) {
117+ attachments = attachments . concat ( product . attachments )
118+ }
119+ } )
120+ }
121+ } )
122+ }
123+ attachments = _ . sortBy ( attachments , attachment => - new Date ( attachment . updatedAt ) . getTime ( ) )
111124 . map ( attachment => ( {
112125 title : attachment . title ,
113126 address : attachment . downloadUrl ,
@@ -148,7 +161,8 @@ class ProjectInfoContainer extends React.Component {
148161
149162ProjectInfoContainer . PropTypes = {
150163 currentMemberRole : PropTypes . string ,
151- project : PropTypes . object . isRequired
164+ project : PropTypes . object . isRequired ,
165+ phases : PropTypes . arrayOf ( PropTypes . object )
152166}
153167
154168const mapDispatchToProps = { updateProject, deleteProject }
0 commit comments