[MM-53149] White Screen when replying to a thread (#25818)

Этот коммит содержится в:
M-ZubairAhmed
2024-01-05 06:47:23 +00:00
коммит произвёл GitHub
родитель 34e1692286
Коммит 4b88bfd5fb
2 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@@ -336,7 +336,7 @@ export function makeGetPostsAroundPost(): (state: GlobalState, postId: Post['id'
for (let i = 0; i < postIds.length; i++) {
const post = allPosts[postIds[i]];
if (shouldFilterJoinLeavePost(post, showJoinLeave, currentUser.username)) {
if (!post || shouldFilterJoinLeavePost(post, showJoinLeave, currentUser.username)) {
continue;
}
@@ -370,15 +370,19 @@ export function makeGetPostsForThread(): (state: GlobalState, rootId: string) =>
thread.push(rootPost);
}
postsForThread?.forEach((id) => {
const post = posts[id];
if (postsForThread && Array.isArray(postsForThread) && postsForThread.length > 0) {
for (const postId of postsForThread) {
const post = posts[postId];
if (!post) {
continue;
}
const skip = shouldFilterJoinLeavePost(post, showJoinLeave, currentUser ? currentUser.username : '');
if (post && !skip) {
thread.push(post);
const skip = shouldFilterJoinLeavePost(post, showJoinLeave, currentUser ? currentUser.username : '');
if (!skip) {
thread.push(post);
}
}
});
}
thread.sort(comparePosts);
return thread;

Просмотреть файл

@@ -106,7 +106,11 @@ const joinLeavePostTypes = [
Posts.POST_TYPES.COMBINED_USER_ACTIVITY,
];
// Returns true if a post should be hidden when the user has Show Join/Leave Messages disabled
/**
* If the user has "Show Join/Leave Messages" disabled, this function will return true if the post should be hidden if it's of type join/leave.
* The post object passed in must be not null/undefined.
* @returns Returns true if a post should be hidden
*/
export function shouldFilterJoinLeavePost(post: Post, showJoinLeave: boolean, currentUsername: string): boolean {
if (showJoinLeave) {
return false;