Skip to content

Commit 4bdce32

Browse files
author
Vikas Agarwal
committed
Github issue#2204, Attachments/File Upload for phase specification question is not working
— Fixed missing links, of product attachments, in the left panel
1 parent e59cc41 commit 4bdce32

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/projects/detail/containers/DashboardContainer.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class DashboardContainer extends React.Component {
8585
<ProjectInfoContainer
8686
currentMemberRole={currentMemberRole}
8787
project={project}
88+
phases={phases}
8889
isSuperUser={isSuperUser}
8990
/>
9091
)

src/projects/detail/containers/ProjectInfoContainer.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

149162
ProjectInfoContainer.PropTypes = {
150163
currentMemberRole: PropTypes.string,
151-
project: PropTypes.object.isRequired
164+
project: PropTypes.object.isRequired,
165+
phases: PropTypes.arrayOf(PropTypes.object)
152166
}
153167

154168
const mapDispatchToProps = { updateProject, deleteProject }

src/projects/detail/containers/ProjectPlanContainer.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const ProjectPlanContainer = (props) => {
4646
<ProjectInfoContainer
4747
currentMemberRole={currentMemberRole}
4848
project={project}
49+
phases={phases}
4950
isSuperUser={isSuperUser}
5051
/>
5152
)

0 commit comments

Comments
 (0)