Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/projects/detail/containers/FeedContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
7 changes: 5 additions & 2 deletions src/projects/detail/containers/MessagesContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down