Page MenuHomePhabricator

D13778.id.diff
No OneTemporary

D13778.id.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
@@ -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

Mime Type
text/plain
Expires
Thu, Oct 24, 6:42 PM (4 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2359169
Default Alt Text
D13778.id.diff (2 KB)

Event Timeline