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 @@ -58,7 +58,6 @@ type ComposableMessageInfo, } from '../types/message-types.js'; import type { - MinimallyEncodedMemberInfo, MinimallyEncodedRawThreadInfo, MinimallyEncodedRelativeMemberInfo, MinimallyEncodedThreadCurrentUserInfo, @@ -84,7 +83,7 @@ import { type RawThreadInfo, type ThreadInfo, - type LegacyMemberInfo, + type MemberInfo, type ServerThreadInfo, type RelativeMemberInfo, type ThreadCurrentUserInfo, @@ -278,10 +277,7 @@ function threadActualMembers( memberInfos: $ReadOnlyArray< - | LegacyMemberInfo - | RelativeMemberInfo - | MinimallyEncodedMemberInfo - | MinimallyEncodedRelativeMemberInfo, + MemberInfo | RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, >, ): $ReadOnlyArray { return memberInfos @@ -290,11 +286,7 @@ } function threadOtherMembers< - T: - | LegacyMemberInfo - | RelativeMemberInfo - | MinimallyEncodedMemberInfo - | MinimallyEncodedRelativeMemberInfo, + T: MemberInfo | RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, >(memberInfos: $ReadOnlyArray, viewerID: ?string): $ReadOnlyArray { return memberInfos.filter( memberInfo => memberInfo.role && memberInfo.id !== viewerID, @@ -1139,8 +1131,7 @@ function memberIsAdmin( memberInfo: | RelativeMemberInfo - | LegacyMemberInfo - | MinimallyEncodedMemberInfo + | MemberInfo | MinimallyEncodedRelativeMemberInfo, threadInfo: | ThreadInfo @@ -1158,9 +1149,8 @@ function memberHasAdminPowers( memberInfo: | RelativeMemberInfo - | LegacyMemberInfo + | MemberInfo | ServerMemberInfo - | MinimallyEncodedMemberInfo | MinimallyEncodedRelativeMemberInfo, ): boolean { if (memberInfo.minimallyEncoded) { 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,6 +15,7 @@ RawMessageInfo, } from './message-types.js'; import type { + MinimallyEncodedMemberInfo, MinimallyEncodedResolvedThreadInfo, MinimallyEncodedRoleInfo, } from './minimally-encoded-thread-permissions-types.js'; @@ -52,6 +53,8 @@ isSender: t.Boolean, }); +export type MemberInfo = LegacyMemberInfo | MinimallyEncodedMemberInfo; + export type RelativeMemberInfo = $ReadOnly<{ ...LegacyMemberInfo, +username: ?string,