[MM-53149] White Screen when replying to a thread (#25818)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
34e1692286
Коммит
4b88bfd5fb
@@ -336,7 +336,7 @@ export function makeGetPostsAroundPost(): (state: GlobalState, postId: Post['id'
|
|||||||
for (let i = 0; i < postIds.length; i++) {
|
for (let i = 0; i < postIds.length; i++) {
|
||||||
const post = allPosts[postIds[i]];
|
const post = allPosts[postIds[i]];
|
||||||
|
|
||||||
if (shouldFilterJoinLeavePost(post, showJoinLeave, currentUser.username)) {
|
if (!post || shouldFilterJoinLeavePost(post, showJoinLeave, currentUser.username)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,15 +370,19 @@ export function makeGetPostsForThread(): (state: GlobalState, rootId: string) =>
|
|||||||
thread.push(rootPost);
|
thread.push(rootPost);
|
||||||
}
|
}
|
||||||
|
|
||||||
postsForThread?.forEach((id) => {
|
if (postsForThread && Array.isArray(postsForThread) && postsForThread.length > 0) {
|
||||||
const post = posts[id];
|
for (const postId of postsForThread) {
|
||||||
|
const post = posts[postId];
|
||||||
|
if (!post) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const skip = shouldFilterJoinLeavePost(post, showJoinLeave, currentUser ? currentUser.username : '');
|
const skip = shouldFilterJoinLeavePost(post, showJoinLeave, currentUser ? currentUser.username : '');
|
||||||
|
if (!skip) {
|
||||||
if (post && !skip) {
|
thread.push(post);
|
||||||
thread.push(post);
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
thread.sort(comparePosts);
|
thread.sort(comparePosts);
|
||||||
return thread;
|
return thread;
|
||||||
|
|||||||
@@ -106,7 +106,11 @@ const joinLeavePostTypes = [
|
|||||||
Posts.POST_TYPES.COMBINED_USER_ACTIVITY,
|
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 {
|
export function shouldFilterJoinLeavePost(post: Post, showJoinLeave: boolean, currentUsername: string): boolean {
|
||||||
if (showJoinLeave) {
|
if (showJoinLeave) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user