Merge branch 'master' into design-pass-adm

This commit is contained in:
Belén Curcio
2017-01-18 14:40:09 -03:00
committed by GitHub
3 changed files with 13 additions and 4 deletions
+8 -3
View File
@@ -37,10 +37,15 @@ export const fetchCommentsByUserId = userId => {
const state = getState();
comments.forEach(comment => dispatch(addItem(comment, 'comments')));
assets.forEach(asset => {
const prevAsset = state.items.getIn(['assets', asset.id]);
// Include data such as hydrated comments from assets already in the system.
const prevAsset = state.items.getIn(['assets', asset.id]).toJS();
dispatch(addItem({...prevAsset, ...asset}, 'assets'));
if (prevAsset) {
// Include data such as hydrated comments from assets already in the system.
dispatch(addItem({...prevAsset.toJS(), ...asset}, 'assets'));
} else {
dispatch(addItem(asset, 'assets'));
}
});
dispatch({type: actions.COMMENTS_BY_USER_SUCCESS, comments: comments.map(comment => comment.id)});