Page MenuHomePhabricator

D10286.id34466.diff
No OneTemporary

D10286.id34466.diff

diff --git a/keyserver/src/fetchers/thread-fetchers.js b/keyserver/src/fetchers/thread-fetchers.js
--- a/keyserver/src/fetchers/thread-fetchers.js
+++ b/keyserver/src/fetchers/thread-fetchers.js
@@ -9,14 +9,17 @@
getContainingThreadID,
getCommunity,
} from 'lib/shared/thread-utils.js';
-import { hasMinCodeVersion } from 'lib/shared/version-utils.js';
+import {
+ FUTURE_CODE_VERSION,
+ hasMinCodeVersion,
+} from 'lib/shared/version-utils.js';
import type { AvatarDBContent, ClientAvatar } from 'lib/types/avatar-types.js';
import type { RawMessageInfo, MessageInfo } from 'lib/types/message-types.js';
import { threadTypes, type ThreadType } from 'lib/types/thread-types-enum.js';
import {
- type LegacyRawThreadInfos,
type ServerThreadInfo,
- type LegacyRawThreadInfo,
+ type RawThreadInfos,
+ type RawThreadInfo,
} from 'lib/types/thread-types.js';
import { ServerError } from 'lib/utils/errors.js';
@@ -245,7 +248,7 @@
}
export type FetchThreadInfosResult = {
- +threadInfos: LegacyRawThreadInfos,
+ +threadInfos: RawThreadInfos,
};
async function fetchThreadInfos(
@@ -277,8 +280,12 @@
const codeVersionBelow283 = !hasMinCodeVersion(viewer.platformDetails, {
native: 285,
});
+ const minimallyEncodedPermissionsSupported = hasMinCodeVersion(
+ viewer.platformDetails,
+ { native: FUTURE_CODE_VERSION },
+ );
- const threadInfos: { [string]: LegacyRawThreadInfo } = {};
+ const threadInfos: { [string]: RawThreadInfo } = {};
for (const threadID in serverResult.threadInfos) {
const serverThreadInfo = serverResult.threadInfos[threadID];
const threadInfo = rawThreadInfoFromServerThreadInfo(
@@ -289,6 +296,7 @@
excludePinInfo: codeVersionBelow209,
filterManageInviteLinksPermission: codeVersionBelow221,
filterVoicedInAnnouncementChannelsPermission: codeVersionBelow283,
+ minimallyEncodePermissions: minimallyEncodedPermissionsSupported,
},
);
if (threadInfo) {
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
@@ -65,6 +65,7 @@
} from '../types/minimally-encoded-thread-permissions-types.js';
import {
decodeMinimallyEncodedRoleInfo,
+ minimallyEncodeRawThreadInfo,
minimallyEncodeThreadInfo,
} from '../types/minimally-encoded-thread-permissions-types.js';
import { userRelationshipStatus } from '../types/relationship-types.js';
@@ -736,12 +737,13 @@
+excludePinInfo?: boolean,
+filterManageInviteLinksPermission?: boolean,
+filterVoicedInAnnouncementChannelsPermission?: boolean,
+ +minimallyEncodePermissions?: boolean,
};
function rawThreadInfoFromServerThreadInfo(
serverThreadInfo: ServerThreadInfo,
viewerID: string,
options?: RawThreadInfoOptions,
-): ?LegacyRawThreadInfo {
+): ?RawThreadInfo {
const filterThreadEditAvatarPermission =
options?.filterThreadEditAvatarPermission;
const excludePinInfo = options?.excludePinInfo;
@@ -749,6 +751,7 @@
options?.filterManageInviteLinksPermission;
const filterVoicedInAnnouncementChannelsPermission =
options?.filterVoicedInAnnouncementChannelsPermission;
+ const shouldMinimallyEncodePermissions = options?.minimallyEncodePermissions;
const filterThreadPermissions = _omitBy(
(v, k) =>
@@ -858,7 +861,9 @@
pinnedCount: serverThreadInfo.pinnedCount,
};
}
- return rawThreadInfo;
+ return shouldMinimallyEncodePermissions
+ ? minimallyEncodeRawThreadInfo(rawThreadInfo)
+ : rawThreadInfo;
}
function threadUIName(threadInfo: ThreadInfo): string | ThreadEntity {

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 6:51 PM (15 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2602003
Default Alt Text
D10286.id34466.diff (3 KB)

Event Timeline