mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
[MM-62587] Hide thread_footer when root post is deleted (#29874)
* [MM-62587] Hide thread_footer when root post is deleted * Also remove the replies line from the RHS * Fix logic to make sure post.delete_at exists * Fix playwright test --------- Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
53d6f59ff5
commit
0beac5c930
4 changed files with 13 additions and 2 deletions
|
|
@ -62,7 +62,7 @@ test('MM-T5435_1 Global Drafts link in sidebar should be hidden when another use
|
|||
}
|
||||
|
||||
// # Open the last post in the channel sent by admin again
|
||||
await lastPostByAdmin.threadFooter.reply();
|
||||
await lastPostByAdmin.body.click();
|
||||
|
||||
// * Verify drafts in user's textbox is still visible
|
||||
const rhsTextboxValue = await sidebarRight.postCreate.getInputValue();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import type {UserThread} from '@mattermost/types/threads';
|
|||
import {threadIsSynthetic} from '@mattermost/types/threads';
|
||||
|
||||
import {setThreadFollow, getThread as fetchThread} from 'mattermost-redux/actions/threads';
|
||||
import {Posts} from 'mattermost-redux/constants';
|
||||
import {getPost} from 'mattermost-redux/selectors/entities/posts';
|
||||
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
||||
import {makeGetThreadOrSynthetic} from 'mattermost-redux/selectors/entities/threads';
|
||||
|
|
@ -79,6 +80,10 @@ function ThreadFooter({
|
|||
dispatch(setThreadFollow(currentUserId, currentTeamId, threadId, !isFollowing));
|
||||
}, [isFollowing]);
|
||||
|
||||
if (post.delete_at > 0 || post.state === Posts.POST_DELETED) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='ThreadFooter'>
|
||||
{!isFollowing || threadIsSynthetic(thread) || !thread.unread_replies ? (
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ type Props = {
|
|||
a11yIndex: number;
|
||||
currentUserId: string;
|
||||
isRootPost: boolean;
|
||||
isDeletedPost: boolean;
|
||||
isLastPost: boolean;
|
||||
listId: string;
|
||||
onCardClick: (post: Post) => void;
|
||||
|
|
@ -38,6 +39,7 @@ function ThreadViewerRow({
|
|||
a11yIndex,
|
||||
currentUserId,
|
||||
isRootPost,
|
||||
isDeletedPost,
|
||||
isLastPost,
|
||||
listId,
|
||||
onCardClick,
|
||||
|
|
@ -76,7 +78,7 @@ function ThreadViewerRow({
|
|||
timestampProps={timestampProps}
|
||||
location={Locations.RHS_ROOT}
|
||||
/>
|
||||
<RootPostDivider postId={listId}/>
|
||||
{!isDeletedPost && <RootPostDivider postId={listId}/>}
|
||||
</>
|
||||
);
|
||||
case PostListUtils.isCombinedUserActivityPost(listId): {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import AutoSizer from 'react-virtualized-auto-sizer';
|
|||
import type {Post} from '@mattermost/types/posts';
|
||||
import type {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
import {Posts} from 'mattermost-redux/constants';
|
||||
import {getNewMessagesIndex, isDateLine, isStartOfNewMessages, isCreateComment} from 'mattermost-redux/utils/post_list';
|
||||
|
||||
import NewRepliesBanner from 'components/new_replies_banner';
|
||||
|
|
@ -349,6 +350,8 @@ class ThreadViewerVirtualized extends PureComponent<Props, State> {
|
|||
|
||||
const isLastPost = itemId === this.props.lastPost.id;
|
||||
const isRootPost = itemId === this.props.selected.id;
|
||||
const isDeletedPost = ('delete_at' in this.props.selected && this.props.selected.delete_at !== 0) ||
|
||||
('state' in this.props.selected && this.props.selected.state === Posts.POST_DELETED);
|
||||
|
||||
if (!isDateLine(itemId) && !isStartOfNewMessages(itemId) && !isCreateComment(itemId) && !isRootPost) {
|
||||
a11yIndex++;
|
||||
|
|
@ -364,6 +367,7 @@ class ThreadViewerVirtualized extends PureComponent<Props, State> {
|
|||
currentUserId={this.props.currentUserId}
|
||||
isRootPost={isRootPost}
|
||||
isLastPost={isLastPost}
|
||||
isDeletedPost={isDeletedPost}
|
||||
listId={itemId}
|
||||
onCardClick={this.props.onCardClick}
|
||||
previousPostId={getPreviousPostId(data, index)}
|
||||
|
|
|
|||
Loading…
Reference in a new issue