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 @@ -266,11 +266,23 @@ return rawThreadInfosFromServerThreadInfos(viewer, serverResult); } +async function fetchPrivilegedThreadInfos( + viewer: Viewer, + inputFilter?: FetchThreadInfosFilter, +): Promise { + const serverResult = await fetchServerThreadInfos(inputFilter); + return rawThreadInfosFromServerThreadInfos(viewer, serverResult, { + addKnowOfPermission: true, + }); +} + function rawThreadInfosFromServerThreadInfos( viewer: Viewer, serverResult: FetchServerThreadInfosResult, + options?: { addKnowOfPermission?: boolean }, ): FetchThreadInfosResult { const viewerID = viewer.id; + const addKnowOfPermission = options?.addKnowOfPermission ?? false; const codeVersionBelow209 = !hasMinCodeVersion(viewer.platformDetails, { native: 209, }); @@ -337,6 +349,7 @@ manageFarcasterChannelTagsPermissionUnsupported, stripMemberPermissions: stripMemberPermissions, canDisplayFarcasterThreadAvatars, + addKnowOfPermission, }, ); if (threadInfo) { @@ -463,6 +476,7 @@ export { fetchServerThreadInfos, + fetchPrivilegedThreadInfos, fetchThreadInfos, rawThreadInfosFromServerThreadInfos, verifyThreadIDs, 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 @@ -761,6 +761,7 @@ +filterManageFarcasterChannelTagsPermission?: boolean, +stripMemberPermissions?: boolean, +canDisplayFarcasterThreadAvatars?: boolean, + +addKnowOfPermission?: boolean, }; function rawThreadInfoFromServerThreadInfo( @@ -785,6 +786,7 @@ const stripMemberPermissions = options?.stripMemberPermissions; const canDisplayFarcasterThreadAvatars = options?.canDisplayFarcasterThreadAvatars; + const addKnowOfPermission = options?.addKnowOfPermission; const filterThreadPermissions = ( innerThreadPermissions: ThreadPermissionsInfo, @@ -802,6 +804,15 @@ }, }; } + if (addKnowOfPermission) { + innerThreadPermissions = { + ...innerThreadPermissions, + [threadPermissions.KNOW_OF]: { + value: true, + source: serverThreadInfo.id, + }, + }; + } return _omitBy( (v, k) => (filterThreadEditAvatarPermission &&