Page MenuHomePhabricator

D12410.diff
No OneTemporary

D12410.diff

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<string>,
): Promise<$ReadOnlyArray<ServerCommunityInfoWithHolder>> {
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 => ({

File Metadata

Mime Type
text/plain
Expires
Sun, Sep 29, 4:09 PM (21 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2197958
Default Alt Text
D12410.diff (1 KB)

Event Timeline