MCPcopy Create free account
hub / github.com/CommE2E/comm / baseThreadIsWithBlockedUserOnly

Function baseThreadIsWithBlockedUserOnly

lib/shared/thread-utils.js:979–1002  ·  view source on GitHub ↗
(
  threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo,
  viewerID: ?string,
  userInfos: UserInfos,
  checkOnlyViewerBlock: boolean,
)

Source from the content-addressed store, hash-verified

977}
978
979function baseThreadIsWithBlockedUserOnly(
980 threadInfo: LegacyRawThreadInfo | RawThreadInfo | ThreadInfo,
981 viewerID: ?string,
982 userInfos: UserInfos,
983 checkOnlyViewerBlock: boolean,
984) {
985 const otherUserID = getSingleOtherUser(threadInfo, viewerID);
986 if (!otherUserID) {
987 return false;
988 }
989 const otherUserRelationshipStatus =
990 userInfos[otherUserID]?.relationshipStatus;
991
992 if (checkOnlyViewerBlock) {
993 return (
994 otherUserRelationshipStatus === userRelationshipStatus.BLOCKED_BY_VIEWER
995 );
996 }
997
998 return (
999 !!otherUserRelationshipStatus &&
1000 relationshipBlockedInEitherDirection(otherUserRelationshipStatus)
1001 );
1002}
1003
1004function threadIsWithBlockedUserOnlyWithoutAdminRoleCheck(
1005 threadInfo: ThreadInfo | RawThreadInfo | LegacyRawThreadInfo,

Calls 2

getSingleOtherUserFunction · 0.85

Tested by

no test coverage detected