diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -898,6 +898,35 @@ ); } +function threadIsWithBlockedUserOnlyWithoutAdminRoleCheck( + threadInfo: ThreadInfo, + viewerID: ?string, + userInfos: UserInfos, + checkOnlyViewerBlock: boolean, +): boolean { + if (threadOrParentThreadIsGroupChat(threadInfo)) { + return false; + } + + const otherUserID = getSingleOtherUser(threadInfo, viewerID); + if (!otherUserID) { + return false; + } + const otherUserRelationshipStatus = + userInfos[otherUserID]?.relationshipStatus; + + if (checkOnlyViewerBlock) { + return ( + otherUserRelationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER + ); + } + + return ( + !!otherUserRelationshipStatus && + relationshipBlockedInEitherDirection(otherUserRelationshipStatus) + ); +} + function innerThreadFrozenDueToBlock( threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo, viewerID: ?string, @@ -938,11 +967,12 @@ return false; } - const options: ThreadIsWithBlockedUserOnlyOptions = { - checkOnlyViewerBlock: true, - skipMemberAdminRoleCheck: true, - }; - return threadIsWithBlockedUserOnly(threadInfo, viewerID, userInfos, options); + return threadIsWithBlockedUserOnlyWithoutAdminRoleCheck( + threadInfo, + viewerID, + userInfos, + true, + ); } const threadTypeDescriptions: { [ThreadType]: string } = {