Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2836409
D12410.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12410.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D12410: [keyserver] update fetchCommunityInfos to query by community ids
Attached
Detach File
Event Timeline
Log In to Comment