Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32219043
D11775.1765184306.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
D11775.1765184306.diff
View Options
diff --git a/lib/actions/community-actions.js b/lib/actions/community-actions.js
--- a/lib/actions/community-actions.js
+++ b/lib/actions/community-actions.js
@@ -1,5 +1,13 @@
// @flow
+import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js';
+import { useKeyserverCall } from '../keyserver-conn/keyserver-call.js';
+import type { CallKeyserverEndpoint } from '../keyserver-conn/keyserver-conn-types.js';
+import type {
+ CreateOrUpdateFarcasterChannelTagRequest,
+ CreateOrUpdateFarcasterChannelTagResponse,
+} from '../types/community-types.js';
+
const updateCalendarCommunityFilter = 'UPDATE_CALENDAR_COMMUNITY_FILTER';
const clearCalendarCommunityFilter = 'CLEAR_CALENDAR_COMMUNITY_FILTER';
const updateChatCommunityFilter = 'UPDATE_CHAT_COMMUNITY_FILTER';
@@ -13,6 +21,41 @@
failed: 'CREATE_OR_UPDATE_FARCASTER_CHANNEL_TAG_FAILED',
});
+const createOrUpdateFarcasterChannelTag =
+ (
+ callKeyserverEndpoint: CallKeyserverEndpoint,
+ ): ((
+ input: CreateOrUpdateFarcasterChannelTagRequest,
+ ) => Promise<CreateOrUpdateFarcasterChannelTagResponse>) =>
+ async input => {
+ const keyserverID = extractKeyserverIDFromID(input.commCommunityID);
+
+ const requests = {
+ [keyserverID]: {
+ commCommunityID: input.commCommunityID,
+ farcasterChannelID: input.farcasterChannelID,
+ },
+ };
+
+ const responses = await callKeyserverEndpoint(
+ 'create_or_update_farcaster_channel_tag',
+ requests,
+ );
+
+ const response = responses[keyserverID];
+
+ return {
+ commCommunityID: response.commCommunityID,
+ blobHolder: response.blobHolder,
+ };
+ };
+
+function useCreateOrUpdateFarcasterChannelTag(): (
+ input: CreateOrUpdateFarcasterChannelTagRequest,
+) => Promise<CreateOrUpdateFarcasterChannelTagResponse> {
+ return useKeyserverCall(createOrUpdateFarcasterChannelTag);
+}
+
export {
updateCalendarCommunityFilter,
clearCalendarCommunityFilter,
@@ -20,4 +63,5 @@
clearChatCommunityFilter,
addCommunityActionType,
createOrUpdateFarcasterChannelTagActionTypes,
+ useCreateOrUpdateFarcasterChannelTag,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 8, 8:58 AM (2 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5847660
Default Alt Text
D11775.1765184306.diff (2 KB)
Attached To
Mode
D11775: [lib] introduce useCreateOrUpdateFarcasterChannelTag
Attached
Detach File
Event Timeline
Log In to Comment