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; }