Page MenuHomePhabricator

D11775.diff
No OneTemporary

D11775.diff

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

Mime Type
text/plain
Expires
Wed, Jan 8, 3:41 PM (4 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2819572
Default Alt Text
D11775.diff (2 KB)

Event Timeline