Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3352119
D10789.id36321.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10789.id36321.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
@@ -63,6 +63,7 @@
MinimallyEncodedThreadCurrentUserInfo,
RoleInfo,
ThreadInfo,
+ MinimallyEncodedMemberInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
import {
decodeMinimallyEncodedRoleInfo,
@@ -91,7 +92,6 @@
import type {
LegacyRawThreadInfo,
LegacyRoleInfo,
- MemberInfo,
ServerThreadInfo,
ServerMemberInfo,
ClientNewThreadRequest,
@@ -99,6 +99,7 @@
ChangeThreadSettingsPayload,
UserProfileThreadInfo,
MixedRawThreadInfos,
+ LegacyMemberInfo,
} from '../types/thread-types.js';
import { updateTypes } from '../types/update-types-enum.js';
import { type ClientUpdateInfo } from '../types/update-types.js';
@@ -219,17 +220,18 @@
}
function threadActualMembers(
- memberInfos: $ReadOnlyArray<MemberInfo | RelativeMemberInfo>,
+ memberInfos: $ReadOnlyArray<
+ LegacyMemberInfo | MinimallyEncodedMemberInfo | RelativeMemberInfo,
+ >,
): $ReadOnlyArray<string> {
return memberInfos
.filter(memberInfo => memberInfo.role)
.map(memberInfo => memberInfo.id);
}
-function threadOtherMembers<T: MemberInfo | RelativeMemberInfo>(
- memberInfos: $ReadOnlyArray<T>,
- viewerID: ?string,
-): $ReadOnlyArray<T> {
+function threadOtherMembers<
+ T: LegacyMemberInfo | MinimallyEncodedMemberInfo | RelativeMemberInfo,
+>(memberInfos: $ReadOnlyArray<T>, viewerID: ?string): $ReadOnlyArray<T> {
return memberInfos.filter(
memberInfo => memberInfo.role && memberInfo.id !== viewerID,
);
@@ -1030,7 +1032,11 @@
// Since we don't have access to all of the ancestor ThreadInfos, we approximate
// "parent admin" as anybody with CHANGE_ROLE permissions.
function memberHasAdminPowers(
- memberInfo: RelativeMemberInfo | MemberInfo | ServerMemberInfo,
+ memberInfo:
+ | RelativeMemberInfo
+ | LegacyMemberInfo
+ | MinimallyEncodedMemberInfo
+ | ServerMemberInfo,
): boolean {
if (memberInfo.minimallyEncoded) {
return hasPermission(memberInfo.permissions, threadPermissions.CHANGE_ROLE);
diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js
--- a/lib/types/thread-types.js
+++ b/lib/types/thread-types.js
@@ -15,7 +15,6 @@
RawMessageInfo,
} from './message-types.js';
import type {
- MinimallyEncodedMemberInfo,
RawThreadInfo,
ResolvedThreadInfo,
ThreadInfo,
@@ -51,8 +50,6 @@
isSender: t.Boolean,
});
-export type MemberInfo = LegacyMemberInfo | MinimallyEncodedMemberInfo;
-
export type LegacyRoleInfo = {
+id: string,
+name: string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 4:40 AM (20 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2573969
Default Alt Text
D10789.id36321.diff (2 KB)
Attached To
Mode
D10789: [lib] Expand `MemberInfo` to `LegacyMemberInfo | MinimallyEncodedMemberInfo`
Attached
Detach File
Event Timeline
Log In to Comment