Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3376564
D12289.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12289.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D12289: [lib] Introduce `threadIsWithBlockedUserOnlyWithoutAdminRoleCheck`
Attached
Detach File
Event Timeline
Log In to Comment