diff --git a/src/discussions/posts/post/PostFooter.jsx b/src/discussions/posts/post/PostFooter.jsx index eb83a4a9..45628f47 100644 --- a/src/discussions/posts/post/PostFooter.jsx +++ b/src/discussions/posts/post/PostFooter.jsx @@ -66,20 +66,31 @@ function PostFooter({ {intl.formatMessage(messages.newLabel, { count: post.unreadCommentCount })} ) : null}
- {!preview - && ( - - - {post.groupName || intl.formatMessage(messages.visibleToAll)} - - )} + { + post.groupId + ? ( + <> + + {post.groupName || intl.formatMessage(messages.visibleToAll)} + + )} + > + + + ยท + + ) : null + } {timeago.format(post.createdAt, intl.locale)} diff --git a/src/discussions/posts/post/PostFooter.test.jsx b/src/discussions/posts/post/PostFooter.test.jsx index 43129653..7ff4ac8c 100644 --- a/src/discussions/posts/post/PostFooter.test.jsx +++ b/src/discussions/posts/post/PostFooter.test.jsx @@ -73,4 +73,12 @@ describe('PostFooter', () => { renderComponent({ ...mockPost, unreadCommentCount: 1, commentCount: 1 }); expect(screen.queryByText('1 new')).toBeFalsy(); }); + + it('has the cohort icon only when group information is present', () => { + renderComponent(mockPost); + expect(screen.queryByTestId('cohort-icon')).toBeFalsy(); + + renderComponent({ ...mockPost, groupId: 5, groupName: 'Test Cohort' }); + expect(screen.getByTestId('cohort-icon')).toBeTruthy(); + }); });