Page MenuHomePhabricator

D10792.id36324.diff
No OneTemporary

D10792.id36324.diff

diff --git a/lib/permissions/minimally-encoded-thread-permissions-validators.js b/lib/permissions/minimally-encoded-thread-permissions-validators.js
--- a/lib/permissions/minimally-encoded-thread-permissions-validators.js
+++ b/lib/permissions/minimally-encoded-thread-permissions-validators.js
@@ -20,7 +20,7 @@
legacyMemberInfoValidator,
legacyRawThreadInfoValidator,
legacyRoleInfoValidator,
- threadCurrentUserInfoValidator,
+ legacyThreadCurrentUserInfoValidator,
} from '../types/thread-types.js';
import type { LegacyRawThreadInfo } from '../types/thread-types.js';
import { threadEntityValidator } from '../utils/entity-text.js';
@@ -35,7 +35,7 @@
const minimallyEncodedThreadCurrentUserInfoValidator: TInterface<MinimallyEncodedThreadCurrentUserInfo> =
tShape<MinimallyEncodedThreadCurrentUserInfo>({
- ...threadCurrentUserInfoValidator.meta.props,
+ ...legacyThreadCurrentUserInfoValidator.meta.props,
minimallyEncoded: tBool(true),
permissions: tHexEncodedPermissionsBitmask,
});
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<ThreadCurrentUserInfo> =
- tShape<ThreadCurrentUserInfo>({
+export const legacyThreadCurrentUserInfoValidator: TInterface<LegacyThreadCurrentUserInfo> =
+ tShape<LegacyThreadCurrentUserInfo>({
role: t.maybe(tID),
permissions: threadPermissionsInfoValidator,
subscription: threadSubscriptionValidator,
@@ -91,7 +91,7 @@
+community: ?string,
+members: $ReadOnlyArray<LegacyMemberInfo>,
+roles: { +[id: string]: LegacyRoleInfo },
- +currentUser: ThreadCurrentUserInfo,
+ +currentUser: LegacyThreadCurrentUserInfo,
+sourceMessageID?: string,
+repliesCount: number,
+pinnedCount?: number,
@@ -113,7 +113,7 @@
community: t.maybe(tID),
members: t.list(legacyMemberInfoValidator),
roles: t.dict(tID, legacyRoleInfoValidator),
- currentUser: threadCurrentUserInfoValidator,
+ currentUser: legacyThreadCurrentUserInfoValidator,
sourceMessageID: t.maybe(tID),
repliesCount: t.Number,
pinnedCount: t.maybe(t.Number),
diff --git a/lib/utils/thread-ops-utils.js b/lib/utils/thread-ops-utils.js
--- a/lib/utils/thread-ops-utils.js
+++ b/lib/utils/thread-ops-utils.js
@@ -24,7 +24,7 @@
legacyMemberInfoValidator,
type LegacyRawThreadInfo,
legacyRoleInfoValidator,
- threadCurrentUserInfoValidator,
+ legacyThreadCurrentUserInfoValidator,
} from '../types/thread-types.js';
function convertRawThreadInfoToClientDBThreadInfo(
@@ -80,7 +80,7 @@
const rawCurrentUser = JSON.parse(clientDBThreadInfo.currentUser);
invariant(
minimallyEncodedThreadCurrentUserInfoValidator.is(rawCurrentUser) ||
- threadCurrentUserInfoValidator.is(rawCurrentUser),
+ legacyThreadCurrentUserInfoValidator.is(rawCurrentUser),
'rawCurrentUser must be valid [MinimallyEncoded]ThreadCurrentUserInfo',
);
const minimallyEncodedCurrentUser = rawCurrentUser.minimallyEncoded
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,

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 8:18 PM (21 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2591130
Default Alt Text
D10792.id36324.diff (6 KB)

Event Timeline