Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33341827
D13778.1768924386.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D13778.1768924386.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
Tue, Jan 20, 3:53 PM (10 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5961425
Default Alt Text
D13778.1768924386.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