Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3699668
D11813.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
D11813.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
@@ -2,7 +2,10 @@
import uuid from 'uuid';
-import { DISABLE_TAGGING_FARCASTER_CHANNEL } from 'lib/shared/community-utils.js';
+import {
+ DISABLE_TAGGING_FARCASTER_CHANNEL,
+ farcasterChannelTagBlobHash,
+} from 'lib/shared/community-utils.js';
import type {
CreateOrUpdateFarcasterChannelTagRequest,
CreateOrUpdateFarcasterChannelTagResponse,
@@ -56,10 +59,6 @@
};
}
-function farcasterChannelTagBlobHash(secret: string): string {
- return `farcaster_channel_tag_${secret}`;
-}
-
function getFarcasterChannelTagBlob(
secret: string,
): Promise<BlobDownloadResult> {
diff --git a/keyserver/src/deleters/farcaster-channel-tag-deleters.js b/keyserver/src/deleters/farcaster-channel-tag-deleters.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/deleters/farcaster-channel-tag-deleters.js
@@ -0,0 +1,32 @@
+// @flow
+
+import {
+ DISABLE_TAGGING_FARCASTER_CHANNEL,
+ farcasterChannelTagBlobHash,
+} from 'lib/shared/community-utils.js';
+import type { DeleteFarcasterChannelTagRequest } from 'lib/types/community-types';
+import { ServerError } from 'lib/utils/errors.js';
+
+import { deleteBlob } from '../services/blob.js';
+import type { Viewer } from '../session/viewer';
+
+async function deleteFarcasterChannelTag(
+ viewer: Viewer,
+ request: DeleteFarcasterChannelTagRequest,
+): Promise<void> {
+ const { farcasterChannelID, blobHolder } = request;
+
+ if (DISABLE_TAGGING_FARCASTER_CHANNEL) {
+ throw new ServerError('internal_error');
+ }
+
+ await deleteBlob(
+ {
+ hash: farcasterChannelTagBlobHash(farcasterChannelID),
+ holder: blobHolder,
+ },
+ true,
+ );
+}
+
+export { deleteFarcasterChannelTag };
diff --git a/lib/shared/community-utils.js b/lib/shared/community-utils.js
--- a/lib/shared/community-utils.js
+++ b/lib/shared/community-utils.js
@@ -2,4 +2,8 @@
const DISABLE_TAGGING_FARCASTER_CHANNEL = true;
-export { DISABLE_TAGGING_FARCASTER_CHANNEL };
+function farcasterChannelTagBlobHash(farcasterChannelID: string): string {
+ return `farcaster_channel_tag_${farcasterChannelID}`;
+}
+
+export { DISABLE_TAGGING_FARCASTER_CHANNEL, farcasterChannelTagBlobHash };
diff --git a/lib/types/community-types.js b/lib/types/community-types.js
--- a/lib/types/community-types.js
+++ b/lib/types/community-types.js
@@ -26,3 +26,9 @@
+commCommunityID: string,
+blobHolder: string,
};
+
+export type DeleteFarcasterChannelTagRequest = {
+ +commCommunityID: string,
+ +farcasterChannelID: string,
+ +blobHolder: string,
+};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 8, 3:49 PM (3 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2819835
Default Alt Text
D11813.diff (2 KB)
Attached To
Mode
D11813: [keyserver] introduce deleteFarcasterChannelTag
Attached
Detach File
Event Timeline
Log In to Comment