Page MenuHomePhabricator

D12287.id40895.diff
No OneTemporary

D12287.id40895.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
@@ -934,6 +934,31 @@
return threadIsWithBlockedUserOnly(threadInfo, viewerID, userInfos, options);
}
+function useThreadFrozenDueToViewersBlock(
+ threadInfo: ThreadInfo,
+ communityThreadInfo: ?ThreadInfo,
+ viewerID: ?string,
+ userInfos: UserInfos,
+): boolean {
+ const communityRootsMembersToRole = useCommunityRootMembersToRole(
+ communityThreadInfo ? [communityThreadInfo] : [],
+ );
+ const memberToRole = communityRootsMembersToRole?.[communityThreadInfo?.id];
+
+ const memberHasAdminRole = threadMembersWithoutAddedAdmin(threadInfo).some(
+ m => roleIsAdminRole(memberToRole?.[m.id]),
+ );
+ if (memberHasAdminRole) {
+ return false;
+ }
+
+ const options: ThreadIsWithBlockedUserOnlyOptions = {
+ checkOnlyViewerBlock: true,
+ skipMemberAdminRoleCheck: true,
+ };
+ return threadIsWithBlockedUserOnly(threadInfo, viewerID, userInfos, options);
+}
+
const threadTypeDescriptions: { [ThreadType]: string } = {
[threadTypes.COMMUNITY_OPEN_SUBTHREAD]:
'Anybody in the parent channel can see an open subchannel.',
@@ -1626,6 +1651,7 @@
filterOutDisabledPermissions,
threadFrozenDueToBlock,
threadFrozenDueToViewerBlock,
+ useThreadFrozenDueToViewersBlock,
rawThreadInfoFromServerThreadInfo,
threadUIName,
threadInfoFromRawThreadInfo,
diff --git a/native/chat/chat-input-bar.react.js b/native/chat/chat-input-bar.react.js
--- a/native/chat/chat-input-bar.react.js
+++ b/native/chat/chat-input-bar.react.js
@@ -60,7 +60,7 @@
checkIfDefaultMembersAreVoiced,
draftKeyFromThreadID,
threadActualMembers,
- threadFrozenDueToViewerBlock,
+ useThreadFrozenDueToViewersBlock,
useThreadHasPermission,
viewerIsMember,
} from 'lib/shared/thread-utils.js';
@@ -315,6 +315,7 @@
+typeaheadMatchedStrings: ?TypeaheadMatchedStrings,
+currentUserIsVoiced: boolean,
+currentUserCanJoin: boolean,
+ +threadFrozen: boolean,
};
type State = {
+text: string,
@@ -701,12 +702,7 @@
if (this.shouldShowTextInput) {
content = this.renderInput();
} else if (
- threadFrozenDueToViewerBlock(
- this.props.threadInfo,
- this.props.communityThreadInfo,
- this.props.viewerID,
- this.props.userInfos,
- ) &&
+ this.props.threadFrozen &&
threadActualMembers(this.props.threadInfo.members).length === 2
) {
content = (
@@ -1269,6 +1265,13 @@
community ? threadInfoSelector(state)[community] : null,
);
+ const threadFrozen = useThreadFrozenDueToViewersBlock(
+ props.threadInfo,
+ communityThreadInfo,
+ viewerID,
+ userInfos,
+ );
+
const userMentionsCandidates = useUserMentionsCandidates(
props.threadInfo,
parentThreadInfo,
@@ -1376,6 +1379,7 @@
typeaheadMatchedStrings={typeaheadMatchedStrings}
currentUserIsVoiced={currentUserIsVoiced}
currentUserCanJoin={currentUserCanJoin}
+ threadFrozen={threadFrozen}
/>
);
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 5, 9:05 AM (4 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2425206
Default Alt Text
D12287.id40895.diff (3 KB)

Event Timeline