Skip to content

Commit 3e9653a

Browse files
author
Vikas Agarwal
committed
Removed phase/product attachments from the project’s common attachments if applcable
1 parent e231f9c commit 3e9653a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/projects/reducers/project.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,23 @@ export const projectState = function (state=initialState, action) {
201201
state.project.attachments.forEach(a => {
202202
if (a.category === `product#${prd.id}`) {
203203
attachments.push(a)
204-
// TODO remove `a` from project's attachments
205204
}
206205
})
207206
}
208207
return { ...prd, attachments }
209208
})
210209
return p
211210
})
211+
// updates projects' attachments which are not coupled with any product/phase
212+
let projectAttachments = []
213+
state.project.attachments.forEach(a => {
214+
if (!a.category || a.category.indexOf('product') !== 0) {
215+
projectAttachments.push(a)
216+
}
217+
})
212218
return update(state, {
219+
project: { attachments : { $set : projectAttachments } },
220+
projectNonDirty: { attachments: { $set: projectAttachments } },
213221
phases: { $set:phases },
214222
phasesNonDirty: { $set: action.payload },
215223
isLoadingPhases: { $set: false}

0 commit comments

Comments
 (0)