Page MenuHomePhabricator

D13613.id44907.diff
No OneTemporary

D13613.id44907.diff

diff --git a/keyserver/src/updaters/thread-updaters.js b/keyserver/src/updaters/thread-updaters.js
--- a/keyserver/src/updaters/thread-updaters.js
+++ b/keyserver/src/updaters/thread-updaters.js
@@ -942,13 +942,12 @@
return null;
}
- const ledChannels =
- await neynarClient?.fetchLedFarcasterChannels(farcasterID);
+ const userLeadsChannel = await neynarClient?.userLeadsChannel(
+ farcasterID,
+ communityFarcasterChannelTag,
+ );
- if (
- !ledChannels ||
- !ledChannels.some(channel => channel.id === communityFarcasterChannelTag)
- ) {
+ if (!userLeadsChannel) {
return null;
}
diff --git a/lib/utils/neynar-client.js b/lib/utils/neynar-client.js
--- a/lib/utils/neynar-client.js
+++ b/lib/utils/neynar-client.js
@@ -225,6 +225,21 @@
}
}
+ userLeadsChannel(fid: string, channelName: string): Promise<boolean> {
+ const userChannelsPromise = (async () => {
+ const ledChannels = await this.fetchLedFarcasterChannels(fid);
+ return ledChannels.some(
+ channel => channel.id === channelName && channel.lead.fid === fid,
+ );
+ })();
+ const channelSearchPromise = (async () => {
+ const channel = await this.fetchFarcasterChannelByName(channelName);
+ return channel?.lead.fid === fid;
+ })();
+
+ return Promise.race([userChannelsPromise, channelSearchPromise]);
+ }
+
async getFarcasterUsers(
fids: $ReadOnlyArray<string>,
): Promise<Array<?FarcasterUser>> {

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 3:38 AM (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2541608
Default Alt Text
D13613.id44907.diff (1 KB)

Event Timeline