Page MenuHomePhabricator

D12289.diff
No OneTemporary

D12289.diff

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
@@ -922,6 +922,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,
@@ -968,15 +997,11 @@
return false;
}
- const options: ThreadIsWithBlockedUserOnlyOptions = {
- checkOnlyViewerBlock: true,
- skipMemberAdminRoleCheck: true,
- };
- return threadIsWithBlockedUserOnly(
+ return threadIsWithBlockedUserOnlyWithoutAdminRoleCheck(
threadInfo,
viewerID,
userInfos,
- options,
+ true,
);
}, [memberHasAdminRole, threadInfo, userInfos, viewerID]);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 1:04 AM (21 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2592245
Default Alt Text
D12289.diff (1 KB)

Event Timeline