diff --git a/keyserver/src/creators/farcaster-channel-tag-creator.js b/keyserver/src/creators/farcaster-channel-tag-creator.js --- a/keyserver/src/creators/farcaster-channel-tag-creator.js +++ b/keyserver/src/creators/farcaster-channel-tag-creator.js @@ -36,16 +36,12 @@ throw new ServerError('internal_error'); } - const [serverCommunityInfos, blobDownload] = await Promise.all([ - fetchCommunityInfos(viewer), + const [communityInfos, blobDownload] = await Promise.all([ + fetchCommunityInfos(viewer, [request.commCommunityID]), getFarcasterChannelTagBlob(request.farcasterChannelID), ]); - const communityInfo = serverCommunityInfos.find( - community => community.id === request.commCommunityID, - ); - - if (!communityInfo) { + if (communityInfos.length !== 1) { throw new ServerError('invalid_parameters'); } diff --git a/keyserver/src/fetchers/community-fetchers.js b/keyserver/src/fetchers/community-fetchers.js --- a/keyserver/src/fetchers/community-fetchers.js +++ b/keyserver/src/fetchers/community-fetchers.js @@ -12,6 +12,7 @@ async function fetchCommunityInfos( viewer: Viewer, + communityIDs?: $ReadOnlyArray, ): Promise<$ReadOnlyArray> { if (!viewer.loggedIn) { return []; @@ -26,6 +27,12 @@ WHERE m.role > 0 `; + if (communityIDs && communityIDs.length > 0) { + query.append(SQL` + AND c.id IN (${communityIDs}) + `); + } + const [result] = await dbQuery(query); const communityInfos = result.map(row => ({