File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
src/projects/detail/containers Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -103,15 +103,18 @@ class FeedView extends React.Component {
103103 author : isSystemUser ( p . userId ) ? SYSTEM_USER : allMembers [ p . userId ]
104104 }
105105 }
106+ const validPost = ( post ) => {
107+ return post . type === 'post' && ( post . body && post . body . trim ( ) . length || ! isSystemUser ( post . userId ) )
108+ }
106109 if ( showAll ) {
107110 // if we are showing all comments, just iterate through the entire array
108111 _ . forEach ( _ . slice ( feed . posts , 1 ) , p => {
109- p . type === 'post' ? item . comments . push ( _toComment ( p ) ) : item . totalComments --
112+ validPost ( p ) ? item . comments . push ( _toComment ( p ) ) : item . totalComments --
110113 } )
111114 } else {
112115 // otherwise iterate from right and add to the beginning of the array
113116 _ . forEachRight ( _ . slice ( feed . posts , 1 ) , ( p ) => {
114- p . type === 'post' ? item . comments . unshift ( _toComment ( p ) ) : item . totalComments --
117+ validPost ( p ) ? item . comments . unshift ( _toComment ( p ) ) : item . totalComments --
115118 if ( ! feed . showAll && item . comments . length === THREAD_MESSAGES_PAGE_SIZE )
116119 return false
117120 } )
Original file line number Diff line number Diff line change @@ -113,15 +113,18 @@ class MessagesView extends React.Component {
113113 author : isSystemUser ( p . userId ) ? SYSTEM_USER : allMembers [ p . userId ]
114114 }
115115 }
116+ const validPost = ( post ) => {
117+ return post . type === 'post' && ( post . body && post . body . trim ( ) . length || ! isSystemUser ( post . userId ) )
118+ }
116119 if ( showAll ) {
117120 // if we are showing all comments, just iterate through the entire array
118121 _ . forEach ( feed . posts , p => {
119- p . type === 'post' ? item . messages . push ( _toComment ( p ) ) : item . totalComments --
122+ validPost ( p ) ? item . messages . push ( _toComment ( p ) ) : item . totalComments --
120123 } )
121124 } else {
122125 // otherwise iterate from right and add to the beginning of the array
123126 _ . forEachRight ( feed . posts , ( p ) => {
124- p . type === 'post' ? item . messages . unshift ( _toComment ( p ) ) : item . totalComments --
127+ validPost ( p ) ? item . messages . unshift ( _toComment ( p ) ) : item . totalComments --
125128 if ( ! feed . showAll && item . messages . length === THREAD_MESSAGES_PAGE_SIZE )
126129 return false
127130 } )
You can’t perform that action at this time.
0 commit comments