Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3308102
D13613.id44907.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
D13613.id44907.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13613: improve logic around checking if user is channel lead
Attached
Detach File
Event Timeline
Log In to Comment