From d996ed8133a5f19b904ad0c0b3f08c8ab0c3c25b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Fri, 6 Dec 2024 00:46:15 +0100 Subject: [PATCH] Fix join/leave messages not showing (#8396) --- .../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 c176b0290..43eb5381a 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 76f6e2a21..d2a8cb514 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; }