diff --git a/src/projects/detail/containers/FeedContainer.js b/src/projects/detail/containers/FeedContainer.js index 4a36eb3bb..f621ca219 100644 --- a/src/projects/detail/containers/FeedContainer.js +++ b/src/projects/detail/containers/FeedContainer.js @@ -103,15 +103,18 @@ class FeedView extends React.Component { author: isSystemUser(p.userId) ? SYSTEM_USER : allMembers[p.userId] } } + const validPost = (post) => { + return post.type === 'post' && (post.body && post.body.trim().length || !isSystemUser(post.userId)) + } if (showAll) { // if we are showing all comments, just iterate through the entire array _.forEach(_.slice(feed.posts, 1), p => { - p.type === 'post' ? item.comments.push(_toComment(p)) : item.totalComments-- + validPost(p) ? item.comments.push(_toComment(p)) : item.totalComments-- }) } else { // otherwise iterate from right and add to the beginning of the array _.forEachRight(_.slice(feed.posts, 1), (p) => { - p.type === 'post' ? item.comments.unshift(_toComment(p)) : item.totalComments-- + validPost(p) ? item.comments.unshift(_toComment(p)) : item.totalComments-- if (!feed.showAll && item.comments.length === THREAD_MESSAGES_PAGE_SIZE) return false }) diff --git a/src/projects/detail/containers/MessagesContainer.js b/src/projects/detail/containers/MessagesContainer.js index 2bc1f1ae9..6b3455a84 100644 --- a/src/projects/detail/containers/MessagesContainer.js +++ b/src/projects/detail/containers/MessagesContainer.js @@ -113,15 +113,18 @@ class MessagesView extends React.Component { author: isSystemUser(p.userId) ? SYSTEM_USER : allMembers[p.userId] } } + const validPost = (post) => { + return post.type === 'post' && (post.body && post.body.trim().length || !isSystemUser(post.userId)) + } if (showAll) { // if we are showing all comments, just iterate through the entire array _.forEach(feed.posts, p => { - p.type === 'post' ? item.messages.push(_toComment(p)) : item.totalComments-- + validPost(p) ? item.messages.push(_toComment(p)) : item.totalComments-- }) } else { // otherwise iterate from right and add to the beginning of the array _.forEachRight(feed.posts, (p) => { - p.type === 'post' ? item.messages.unshift(_toComment(p)) : item.totalComments-- + validPost(p) ? item.messages.unshift(_toComment(p)) : item.totalComments-- if (!feed.showAll && item.messages.length === THREAD_MESSAGES_PAGE_SIZE) return false })