diff --git a/lib/permissions/minimally-encoded-thread-permissions.test.js b/lib/permissions/minimally-encoded-thread-permissions.test.js --- a/lib/permissions/minimally-encoded-thread-permissions.test.js +++ b/lib/permissions/minimally-encoded-thread-permissions.test.js @@ -26,7 +26,7 @@ minimallyEncodeThreadCurrentUserInfo, } from '../types/minimally-encoded-thread-permissions-types.js'; import type { ThreadRolePermissionsBlob } from '../types/thread-permission-types.js'; -import type { ThreadCurrentUserInfo } from '../types/thread-types.js'; +import type { LegacyThreadCurrentUserInfo } from '../types/thread-types.js'; const permissions = { know_of: { value: true, source: '1' }, @@ -515,7 +515,7 @@ }); }); -const threadCurrentUserInfo: ThreadCurrentUserInfo = { +const threadCurrentUserInfo: LegacyThreadCurrentUserInfo = { role: '256|83795', permissions: { know_of: { diff --git a/lib/types/minimally-encoded-thread-permissions-types.js b/lib/types/minimally-encoded-thread-permissions-types.js --- a/lib/types/minimally-encoded-thread-permissions-types.js +++ b/lib/types/minimally-encoded-thread-permissions-types.js @@ -9,7 +9,7 @@ LegacyMemberInfo, LegacyRawThreadInfo, LegacyRoleInfo, - ThreadCurrentUserInfo, + LegacyThreadCurrentUserInfo, } from './thread-types.js'; import { decodeThreadRolePermissionsBitmaskArray, @@ -50,13 +50,13 @@ }; export type MinimallyEncodedThreadCurrentUserInfo = $ReadOnly<{ - ...ThreadCurrentUserInfo, + ...LegacyThreadCurrentUserInfo, +minimallyEncoded: true, +permissions: string, }>; const minimallyEncodeThreadCurrentUserInfo = ( - threadCurrentUserInfo: ThreadCurrentUserInfo, + threadCurrentUserInfo: LegacyThreadCurrentUserInfo, ): MinimallyEncodedThreadCurrentUserInfo => { invariant( !('minimallyEncoded' in threadCurrentUserInfo), @@ -71,7 +71,7 @@ const decodeMinimallyEncodedThreadCurrentUserInfo = ( minimallyEncodedThreadCurrentUserInfo: MinimallyEncodedThreadCurrentUserInfo, -): ThreadCurrentUserInfo => { +): LegacyThreadCurrentUserInfo => { const { minimallyEncoded, ...rest } = minimallyEncodedThreadCurrentUserInfo; return { ...rest, 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 @@ -64,14 +64,14 @@ isDefault: t.Boolean, }); -export type ThreadCurrentUserInfo = { +export type LegacyThreadCurrentUserInfo = { +role: ?string, +permissions: ThreadPermissionsInfo, +subscription: ThreadSubscription, +unread: ?boolean, }; -export const threadCurrentUserInfoValidator: TInterface = - tShape({ +export const threadCurrentUserInfoValidator: TInterface = + tShape({ role: t.maybe(tID), permissions: threadPermissionsInfoValidator, subscription: threadSubscriptionValidator, @@ -91,7 +91,7 @@ +community: ?string, +members: $ReadOnlyArray, +roles: { +[id: string]: LegacyRoleInfo }, - +currentUser: ThreadCurrentUserInfo, + +currentUser: LegacyThreadCurrentUserInfo, +sourceMessageID?: string, +repliesCount: number, +pinnedCount?: number, diff --git a/native/redux/edit-thread-permission-migration.js b/native/redux/edit-thread-permission-migration.js --- a/native/redux/edit-thread-permission-migration.js +++ b/native/redux/edit-thread-permission-migration.js @@ -3,14 +3,14 @@ import { threadTypes } from 'lib/types/thread-types-enum.js'; import type { LegacyMemberInfo, - ThreadCurrentUserInfo, LegacyRawThreadInfo, LegacyRoleInfo, LegacyRawThreadInfos, + LegacyThreadCurrentUserInfo, } from 'lib/types/thread-types.js'; function addDetailedThreadEditPermissionsToUser< - T: LegacyMemberInfo | ThreadCurrentUserInfo, + T: LegacyMemberInfo | LegacyThreadCurrentUserInfo, >(threadInfo: LegacyRawThreadInfo, member: T, threadID: string): T { let newPermissions = null; if (threadInfo.type === threadTypes.PRIVATE) { diff --git a/native/redux/manage-pins-permission-migration.js b/native/redux/manage-pins-permission-migration.js --- a/native/redux/manage-pins-permission-migration.js +++ b/native/redux/manage-pins-permission-migration.js @@ -3,7 +3,7 @@ import type { LegacyRawThreadInfo, LegacyMemberInfo, - ThreadCurrentUserInfo, + LegacyThreadCurrentUserInfo, LegacyRoleInfo, LegacyRawThreadInfos, } from 'lib/types/thread-types.js'; @@ -13,7 +13,7 @@ const adminRoleName = 'Admins'; function addManagePinsThreadPermissionToUser< - TargetMemberInfo: LegacyMemberInfo | ThreadCurrentUserInfo, + TargetMemberInfo: LegacyMemberInfo | LegacyThreadCurrentUserInfo, >( threadInfo: LegacyRawThreadInfo, member: TargetMemberInfo,