From 047583947f75c927cc1db639165d72de1bf4fb6a Mon Sep 17 00:00:00 2001
From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
Date: Fri, 28 Jul 2023 15:35:18 -0400
Subject: [PATCH] [MM-53636] Add channel/team name back for the Saved Posts
view (#24117)
* [MM-53636] Add channel/team name back for the Saved Posts view
* E2E test
---
.../channels/messaging/post_pre_header_spec.js | 13 +++++++++++++
.../channels/src/components/post/post_component.tsx | 4 ++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/e2e-tests/cypress/tests/integration/channels/messaging/post_pre_header_spec.js b/e2e-tests/cypress/tests/integration/channels/messaging/post_pre_header_spec.js
index a9dcaa737c..2c4eeca231 100644
--- a/e2e-tests/cypress/tests/integration/channels/messaging/post_pre_header_spec.js
+++ b/e2e-tests/cypress/tests/integration/channels/messaging/post_pre_header_spec.js
@@ -40,6 +40,19 @@ describe('Post PreHeader', () => {
// * Assert the preHeader is displayed and works as expected
verifySavedPost(postId, message);
+ // # Click the saved link
+ cy.get('@savedLink').click();
+
+ // * Check that the saved post shows the channel name
+ cy.findByTestId('search-item-container').within(() => {
+ cy.get('span.search-channel__name').
+ should('be.visible').
+ and('have.text', 'Off-Topic');
+ });
+
+ // # Close the RHS
+ cy.get('#searchResultsCloseButton').should('be.visible').click();
+
// # Click again the center save icon of a post
cy.clickPostSaveIcon(postId);
diff --git a/webapp/channels/src/components/post/post_component.tsx b/webapp/channels/src/components/post/post_component.tsx
index 10742a8820..fb16580ece 100644
--- a/webapp/channels/src/components/post/post_component.tsx
+++ b/webapp/channels/src/components/post/post_component.tsx
@@ -527,7 +527,7 @@ const PostComponent = (props: Props): JSX.Element => {
className='search-channel__name__container'
aria-hidden='true'
>
- {Boolean(isSearchResultItem) &&
+ {(Boolean(isSearchResultItem) || props.isFlaggedPosts) &&
{channelDisplayName}
@@ -541,7 +541,7 @@ const PostComponent = (props: Props): JSX.Element => {
/>
}
- {Boolean(isSearchResultItem) && Boolean(props.teamDisplayName) &&
+ {(Boolean(isSearchResultItem) || props.isFlaggedPosts) && Boolean(props.teamDisplayName) &&
{props.teamDisplayName}