diff options
author | Chocobozzz <me@florianbigard.com> | 2020-05-14 16:56:15 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-05-29 09:21:26 +0200 |
commit | 444c0a0e017824fb4ce526281a22c4abe0a13c50 (patch) | |
tree | 6a3c1ea8c4995361c582176257d1e1315287411d /shared | |
parent | 99139e7753e20ab0fba8eae5638d3dd3e792fe43 (diff) | |
download | PeerTube-444c0a0e017824fb4ce526281a22c4abe0a13c50.tar.gz PeerTube-444c0a0e017824fb4ce526281a22c4abe0a13c50.tar.zst PeerTube-444c0a0e017824fb4ce526281a22c4abe0a13c50.zip |
Add ability to bulk delete comments
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/bulk/bulk.ts | 24 | ||||
-rw-r--r-- | shared/extra-utils/index.ts | 1 | ||||
-rw-r--r-- | shared/models/bulk/bulk-remove-comments-of-body.model.ts | 4 |
3 files changed, 29 insertions, 0 deletions
diff --git a/shared/extra-utils/bulk/bulk.ts b/shared/extra-utils/bulk/bulk.ts new file mode 100644 index 000000000..d6798ceb7 --- /dev/null +++ b/shared/extra-utils/bulk/bulk.ts | |||
@@ -0,0 +1,24 @@ | |||
1 | import { BulkRemoveCommentsOfBody } from "@shared/models/bulk/bulk-remove-comments-of-body.model" | ||
2 | import { makePostBodyRequest } from "../requests/requests" | ||
3 | |||
4 | function bulkRemoveCommentsOf (options: { | ||
5 | url: string | ||
6 | token: string | ||
7 | attributes: BulkRemoveCommentsOfBody | ||
8 | expectedStatus?: number | ||
9 | }) { | ||
10 | const { url, token, attributes, expectedStatus } = options | ||
11 | const path = '/api/v1/bulk/remove-comments-of' | ||
12 | |||
13 | return makePostBodyRequest({ | ||
14 | url, | ||
15 | path, | ||
16 | token, | ||
17 | fields: attributes, | ||
18 | statusCodeExpected: expectedStatus || 204 | ||
19 | }) | ||
20 | } | ||
21 | |||
22 | export { | ||
23 | bulkRemoveCommentsOf | ||
24 | } | ||
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index d3f010b20..2ac0c6338 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | export * from './server/activitypub' | 1 | export * from './server/activitypub' |
2 | export * from './bulk/bulk' | ||
2 | export * from './cli/cli' | 3 | export * from './cli/cli' |
3 | export * from './server/clients' | 4 | export * from './server/clients' |
4 | export * from './server/config' | 5 | export * from './server/config' |
diff --git a/shared/models/bulk/bulk-remove-comments-of-body.model.ts b/shared/models/bulk/bulk-remove-comments-of-body.model.ts new file mode 100644 index 000000000..31e018c2a --- /dev/null +++ b/shared/models/bulk/bulk-remove-comments-of-body.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface BulkRemoveCommentsOfBody { | ||
2 | accountName: string | ||
3 | scope: 'my-videos' | 'instance' | ||
4 | } | ||