Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3342349
D13778.id45351.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13778.id45351.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
@@ -27,6 +27,7 @@
} from '../services/blob.js';
import { Viewer } from '../session/viewer.js';
import { thisKeyserverID } from '../user/identity.js';
+import { neynarClient } from '../utils/fc-cache.js';
import { getAndAssertKeyserverURLFacts } from '../utils/urls.js';
async function createOrUpdateFarcasterChannelTag(
@@ -39,13 +40,32 @@
threadPermissions.MANAGE_FARCASTER_CHANNEL_TAGS,
);
- const [hasPermission, communityInfos, blobDownload, keyserverID] =
- await Promise.all([
- permissionPromise,
- fetchCommunityInfos(viewer, [request.commCommunityID]),
- getFarcasterChannelTagBlob(request.farcasterChannelID),
- thisKeyserverID(),
- ]);
+ const neynarChannelDescriptionPromise = (async () => {
+ if (!neynarClient) {
+ return '';
+ }
+ const channelInfo = await neynarClient?.fetchFarcasterChannelByID(
+ request.farcasterChannelID,
+ );
+ if (!channelInfo) {
+ return '';
+ }
+ return channelInfo.description;
+ })();
+
+ const [
+ hasPermission,
+ communityInfos,
+ blobDownload,
+ keyserverID,
+ neynarChannelDescription,
+ ] = await Promise.all([
+ permissionPromise,
+ fetchCommunityInfos(viewer, [request.commCommunityID]),
+ getFarcasterChannelTagBlob(request.farcasterChannelID),
+ thisKeyserverID(),
+ neynarChannelDescriptionPromise,
+ ]);
if (!hasPermission) {
throw new ServerError('invalid_credentials');
@@ -91,6 +111,18 @@
blob_holder = ${blobHolder}
WHERE id = ${request.commCommunityID};
+ UPDATE threads
+ SET
+ avatar = '{"type":"farcaster"}'
+ WHERE id = ${request.commCommunityID}
+ AND avatar IS NULL;
+
+ UPDATE threads
+ SET
+ description = ${neynarChannelDescription}
+ WHERE id = ${request.commCommunityID}
+ AND (description IS NULL OR description = '');
+
COMMIT;
SELECT
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 1:20 AM (16 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2567020
Default Alt Text
D13778.id45351.diff (2 KB)
Attached To
Mode
D13778: set farcaster avatar and channel description in db during createOrUpdateFarcasterChannelTag
Attached
Detach File
Event Timeline
Log In to Comment