From fc87d165784cae064ec218a40c4d1c8b8d9e1f25 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Fri, 6 Dec 2024 07:50:56 +0100 Subject: [PATCH] Fix join/leave messages not showing (#8396) (#8397) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit d996ed8133a5f19b904ad0c0b3f08c8ab0c3c25b) Co-authored-by: Daniel Espino GarcĂ­a --- .../combined_user_activity/combined_user_activity.tsx | 4 ++-- app/utils/post_list/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/post_list/combined_user_activity/combined_user_activity.tsx b/app/components/post_list/combined_user_activity/combined_user_activity.tsx index c176b02905f..43eb5381ad8 100644 --- a/app/components/post_list/combined_user_activity/combined_user_activity.tsx +++ b/app/components/post_list/combined_user_activity/combined_user_activity.tsx @@ -116,12 +116,12 @@ const CombinedUserActivity = ({ } }, [post, canDelete, isTablet, intl, location]); - const renderMessage = (postType: string, userIds: string[], actorId: string) => { + const renderMessage = (postType: string, userIds: string[], actorId?: string) => { if (!post) { return null; } let actor = ''; - if (secureGetFromRecord(usernamesById, actorId)) { + if (actorId && secureGetFromRecord(usernamesById, actorId)) { actor = `@${usernamesById[actorId]}`; } diff --git a/app/utils/post_list/index.ts b/app/utils/post_list/index.ts index 76f6e2a212f..d2a8cb514c7 100644 --- a/app/utils/post_list/index.ts +++ b/app/utils/post_list/index.ts @@ -389,7 +389,7 @@ export function shouldFilterJoinLeavePost(post: PostModel, showJoinLeave: boolea } export type MessageData = { - actorId: string; + actorId?: string; postType: string; userIds: string[]; } @@ -399,7 +399,7 @@ function isMessageData(v: unknown): v is MessageData { return false; } - if (!('actorId' in v) || typeof v.actorId !== 'string') { + if (('actorId' in v) && typeof v.actorId !== 'string') { return false; }