@atproto/bsky 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/api/com/atproto/moderation/util.d.ts +4 -3
- package/dist/context.d.ts +15 -0
- package/dist/db/index.js +26 -1
- package/dist/db/index.js.map +3 -3
- package/dist/db/migrations/20231003T202833377Z-create-moderation-subject-status.d.ts +3 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/pagination.d.ts +2 -1
- package/dist/db/{periodic-moderation-action-reversal.d.ts → periodic-moderation-event-reversal.d.ts} +3 -5
- package/dist/db/tables/moderation.d.ts +24 -34
- package/dist/feed-gen/types.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2750 -2121
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +11 -18
- package/dist/lexicon/lexicons.d.ts +414 -399
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +1 -7
- package/dist/lexicon/types/app/bsky/graph/defs.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +114 -48
- package/dist/lexicon/types/com/atproto/admin/{takeModerationAction.d.ts → emitModerationEvent.d.ts} +5 -6
- package/dist/lexicon/types/com/atproto/admin/{getModerationAction.d.ts → getModerationEvent.d.ts} +1 -1
- package/dist/lexicon/types/com/atproto/admin/{getModerationActions.d.ts → queryModerationEvents.d.ts} +5 -1
- package/dist/lexicon/types/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +12 -6
- package/dist/lexicon/types/com/atproto/admin/sendEmail.d.ts +1 -0
- package/dist/migrate-moderation-data.d.ts +1 -0
- package/dist/services/actor/views.d.ts +2 -5
- package/dist/services/feed/index.d.ts +1 -0
- package/dist/services/feed/util.d.ts +9 -1
- package/dist/services/feed/views.d.ts +6 -17
- package/dist/services/graph/index.d.ts +5 -29
- package/dist/services/graph/types.d.ts +1 -0
- package/dist/services/moderation/index.d.ts +135 -72
- package/dist/services/moderation/pagination.d.ts +36 -0
- package/dist/services/moderation/status.d.ts +13 -0
- package/dist/services/moderation/types.d.ts +35 -0
- package/dist/services/moderation/views.d.ts +18 -14
- package/dist/util/debug.d.ts +1 -1
- package/package.json +11 -11
- package/src/api/app/bsky/feed/getActorFeeds.ts +2 -1
- package/src/api/app/bsky/feed/getActorLikes.ts +1 -3
- package/src/api/app/bsky/feed/getAuthorFeed.ts +1 -3
- package/src/api/app/bsky/feed/getFeed.ts +9 -9
- package/src/api/app/bsky/feed/getFeedGenerator.ts +3 -0
- package/src/api/app/bsky/feed/getFeedGenerators.ts +2 -1
- package/src/api/app/bsky/feed/getListFeed.ts +1 -3
- package/src/api/app/bsky/feed/getPostThread.ts +15 -54
- package/src/api/app/bsky/feed/getPosts.ts +21 -18
- package/src/api/app/bsky/feed/getSuggestedFeeds.ts +2 -1
- package/src/api/app/bsky/feed/getTimeline.ts +1 -3
- package/src/api/app/bsky/feed/searchPosts.ts +20 -17
- package/src/api/app/bsky/graph/getList.ts +6 -3
- package/src/api/app/bsky/graph/getListBlocks.ts +3 -2
- package/src/api/app/bsky/graph/getListMutes.ts +2 -1
- package/src/api/app/bsky/graph/getLists.ts +2 -1
- package/src/api/app/bsky/unspecced/getPopularFeedGenerators.ts +3 -1
- package/src/api/blob-resolver.ts +6 -11
- package/src/api/com/atproto/admin/emitModerationEvent.ts +220 -0
- package/src/api/com/atproto/admin/{getModerationActions.ts → getModerationEvent.ts} +5 -11
- package/src/api/com/atproto/admin/getRecord.ts +1 -0
- package/src/api/com/atproto/admin/{getModerationReports.ts → queryModerationEvents.ts} +13 -16
- package/src/api/com/atproto/admin/queryModerationStatuses.ts +55 -0
- package/src/api/com/atproto/moderation/createReport.ts +9 -7
- package/src/api/com/atproto/moderation/util.ts +38 -20
- package/src/api/index.ts +8 -14
- package/src/auth.ts +29 -21
- package/src/auto-moderator/index.ts +26 -19
- package/src/context.ts +4 -0
- package/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts +123 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/db/pagination.ts +26 -3
- package/src/db/{periodic-moderation-action-reversal.ts → periodic-moderation-event-reversal.ts} +50 -46
- package/src/db/tables/moderation.ts +35 -52
- package/src/feed-gen/best-of-follows.ts +6 -3
- package/src/feed-gen/bsky-team.ts +1 -1
- package/src/feed-gen/hot-classic.ts +1 -1
- package/src/feed-gen/mutuals.ts +6 -2
- package/src/feed-gen/types.ts +1 -1
- package/src/feed-gen/whats-hot.ts +1 -1
- package/src/feed-gen/with-friends.ts +7 -3
- package/src/index.ts +2 -1
- package/src/lexicon/index.ts +30 -67
- package/src/lexicon/lexicons.ts +526 -491
- package/src/lexicon/types/app/bsky/feed/defs.ts +1 -18
- package/src/lexicon/types/app/bsky/graph/defs.ts +1 -0
- package/src/lexicon/types/com/atproto/admin/defs.ts +276 -84
- package/src/lexicon/types/com/atproto/admin/{takeModerationAction.ts → emitModerationEvent.ts} +13 -11
- package/src/lexicon/types/com/atproto/admin/{getModerationReport.ts → getModerationEvent.ts} +1 -1
- package/src/lexicon/types/com/atproto/admin/{getModerationActions.ts → queryModerationEvents.ts} +8 -1
- package/src/lexicon/types/com/atproto/admin/{getModerationReports.ts → queryModerationStatuses.ts} +21 -14
- package/src/lexicon/types/com/atproto/admin/sendEmail.ts +1 -0
- package/src/migrate-moderation-data.ts +414 -0
- package/src/services/actor/views.ts +5 -14
- package/src/services/feed/index.ts +26 -7
- package/src/services/feed/util.ts +47 -19
- package/src/services/feed/views.ts +68 -4
- package/src/services/graph/index.ts +21 -3
- package/src/services/graph/types.ts +1 -0
- package/src/services/indexing/plugins/block.ts +2 -3
- package/src/services/indexing/plugins/feed-generator.ts +2 -3
- package/src/services/indexing/plugins/follow.ts +2 -3
- package/src/services/indexing/plugins/like.ts +2 -3
- package/src/services/indexing/plugins/list-block.ts +2 -3
- package/src/services/indexing/plugins/list-item.ts +2 -3
- package/src/services/indexing/plugins/list.ts +2 -3
- package/src/services/indexing/plugins/post.ts +3 -4
- package/src/services/indexing/plugins/repost.ts +2 -3
- package/src/services/indexing/plugins/thread-gate.ts +2 -3
- package/src/services/label/index.ts +2 -3
- package/src/services/moderation/index.ts +380 -395
- package/src/services/moderation/pagination.ts +96 -0
- package/src/services/moderation/status.ts +244 -0
- package/src/services/moderation/types.ts +49 -0
- package/src/services/moderation/views.ts +278 -329
- package/src/util/debug.ts +2 -2
- package/tests/__snapshots__/feed-generation.test.ts.snap +322 -6
- package/tests/__snapshots__/indexing.test.ts.snap +0 -6
- package/tests/admin/__snapshots__/get-record.test.ts.snap +30 -132
- package/tests/admin/__snapshots__/get-repo.test.ts.snap +14 -60
- package/tests/admin/__snapshots__/moderation-events.test.ts.snap +146 -0
- package/tests/admin/__snapshots__/moderation-statuses.test.ts.snap +64 -0
- package/tests/admin/__snapshots__/moderation.test.ts.snap +0 -125
- package/tests/admin/get-record.test.ts +5 -9
- package/tests/admin/get-repo.test.ts +5 -9
- package/tests/admin/moderation-events.test.ts +221 -0
- package/tests/admin/moderation-statuses.test.ts +145 -0
- package/tests/admin/moderation.test.ts +512 -860
- package/tests/admin/repo-search.test.ts +2 -3
- package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -1
- package/tests/auto-moderator/takedowns.test.ts +45 -18
- package/tests/feed-generation.test.ts +57 -9
- package/tests/views/__snapshots__/block-lists.test.ts.snap +3 -9
- package/tests/views/__snapshots__/blocks.test.ts.snap +0 -9
- package/tests/views/__snapshots__/mute-lists.test.ts.snap +5 -5
- package/tests/views/__snapshots__/mutes.test.ts.snap +0 -3
- package/tests/views/__snapshots__/thread.test.ts.snap +0 -30
- package/tests/views/actor-search.test.ts +2 -3
- package/tests/views/author-feed.test.ts +42 -36
- package/tests/views/follows.test.ts +40 -35
- package/tests/views/list-feed.test.ts +17 -9
- package/tests/views/notifications.test.ts +13 -9
- package/tests/views/profile.test.ts +20 -18
- package/tests/views/thread.test.ts +54 -26
- package/tests/views/threadgating.test.ts +51 -19
- package/tests/views/timeline.test.ts +21 -13
- package/dist/api/com/atproto/admin/resolveModerationReports.d.ts +0 -3
- package/dist/api/com/atproto/admin/reverseModerationAction.d.ts +0 -3
- package/dist/api/com/atproto/admin/takeModerationAction.d.ts +0 -3
- package/dist/lexicon/types/com/atproto/admin/getModerationReport.d.ts +0 -29
- package/dist/lexicon/types/com/atproto/admin/resolveModerationReports.d.ts +0 -36
- package/dist/lexicon/types/com/atproto/admin/reverseModerationAction.d.ts +0 -36
- package/src/api/com/atproto/admin/getModerationAction.ts +0 -44
- package/src/api/com/atproto/admin/getModerationReport.ts +0 -43
- package/src/api/com/atproto/admin/resolveModerationReports.ts +0 -24
- package/src/api/com/atproto/admin/reverseModerationAction.ts +0 -115
- package/src/api/com/atproto/admin/takeModerationAction.ts +0 -156
- package/src/lexicon/types/com/atproto/admin/getModerationAction.ts +0 -41
- package/src/lexicon/types/com/atproto/admin/resolveModerationReports.ts +0 -49
- package/src/lexicon/types/com/atproto/admin/reverseModerationAction.ts +0 -49
- package/tests/admin/__snapshots__/get-moderation-action.test.ts.snap +0 -172
- package/tests/admin/__snapshots__/get-moderation-actions.test.ts.snap +0 -178
- package/tests/admin/__snapshots__/get-moderation-report.test.ts.snap +0 -177
- package/tests/admin/__snapshots__/get-moderation-reports.test.ts.snap +0 -307
- package/tests/admin/get-moderation-action.test.ts +0 -100
- package/tests/admin/get-moderation-actions.test.ts +0 -164
- package/tests/admin/get-moderation-report.test.ts +0 -100
- package/tests/admin/get-moderation-reports.test.ts +0 -332
- /package/dist/api/com/atproto/admin/{getModerationAction.d.ts → emitModerationEvent.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationActions.d.ts → getModerationEvent.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationReport.d.ts → queryModerationEvents.d.ts} +0 -0
- /package/dist/api/com/atproto/admin/{getModerationReports.d.ts → queryModerationStatuses.d.ts} +0 -0
|
@@ -2,7 +2,6 @@ import AtpAgent from '@atproto/api'
|
|
|
2
2
|
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot, paginateAll, stripViewer } from '../_util'
|
|
4
4
|
import followsSeed from '../seeds/follows'
|
|
5
|
-
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
6
5
|
|
|
7
6
|
describe('pds follow views', () => {
|
|
8
7
|
let agent: AtpAgent
|
|
@@ -121,22 +120,21 @@ describe('pds follow views', () => {
|
|
|
121
120
|
})
|
|
122
121
|
|
|
123
122
|
it('blocks followers by actor takedown', async () => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
did: sc.dids.dan,
|
|
131
|
-
},
|
|
132
|
-
createdBy: 'did:example:admin',
|
|
133
|
-
reason: 'Y',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
encoding: 'application/json',
|
|
137
|
-
headers: network.pds.adminAuthHeaders(),
|
|
123
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
124
|
+
{
|
|
125
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
126
|
+
subject: {
|
|
127
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
128
|
+
did: sc.dids.dan,
|
|
138
129
|
},
|
|
139
|
-
|
|
130
|
+
createdBy: 'did:example:admin',
|
|
131
|
+
reason: 'Y',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
encoding: 'application/json',
|
|
135
|
+
headers: network.pds.adminAuthHeaders(),
|
|
136
|
+
},
|
|
137
|
+
)
|
|
140
138
|
|
|
141
139
|
const aliceFollowers = await agent.api.app.bsky.graph.getFollowers(
|
|
142
140
|
{ actor: sc.dids.alice },
|
|
@@ -147,9 +145,13 @@ describe('pds follow views', () => {
|
|
|
147
145
|
sc.dids.dan,
|
|
148
146
|
)
|
|
149
147
|
|
|
150
|
-
await agent.api.com.atproto.admin.
|
|
148
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
151
149
|
{
|
|
152
|
-
|
|
150
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
151
|
+
subject: {
|
|
152
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
153
|
+
did: sc.dids.dan,
|
|
154
|
+
},
|
|
153
155
|
createdBy: 'did:example:admin',
|
|
154
156
|
reason: 'Y',
|
|
155
157
|
},
|
|
@@ -250,22 +252,21 @@ describe('pds follow views', () => {
|
|
|
250
252
|
})
|
|
251
253
|
|
|
252
254
|
it('blocks follows by actor takedown', async () => {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
{
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
did: sc.dids.dan,
|
|
260
|
-
},
|
|
261
|
-
createdBy: 'did:example:admin',
|
|
262
|
-
reason: 'Y',
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
encoding: 'application/json',
|
|
266
|
-
headers: network.pds.adminAuthHeaders(),
|
|
255
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
256
|
+
{
|
|
257
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
258
|
+
subject: {
|
|
259
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
260
|
+
did: sc.dids.dan,
|
|
267
261
|
},
|
|
268
|
-
|
|
262
|
+
createdBy: 'did:example:admin',
|
|
263
|
+
reason: 'Y',
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
encoding: 'application/json',
|
|
267
|
+
headers: network.pds.adminAuthHeaders(),
|
|
268
|
+
},
|
|
269
|
+
)
|
|
269
270
|
|
|
270
271
|
const aliceFollows = await agent.api.app.bsky.graph.getFollows(
|
|
271
272
|
{ actor: sc.dids.alice },
|
|
@@ -276,9 +277,13 @@ describe('pds follow views', () => {
|
|
|
276
277
|
sc.dids.dan,
|
|
277
278
|
)
|
|
278
279
|
|
|
279
|
-
await agent.api.com.atproto.admin.
|
|
280
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
280
281
|
{
|
|
281
|
-
|
|
282
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
283
|
+
subject: {
|
|
284
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
285
|
+
did: sc.dids.dan,
|
|
286
|
+
},
|
|
282
287
|
createdBy: 'did:example:admin',
|
|
283
288
|
reason: 'Y',
|
|
284
289
|
},
|
|
@@ -2,7 +2,6 @@ import AtpAgent from '@atproto/api'
|
|
|
2
2
|
import { TestNetwork, SeedClient, RecordRef } from '@atproto/dev-env'
|
|
3
3
|
import { forSnapshot, paginateAll, stripViewerFromPost } from '../_util'
|
|
4
4
|
import basicSeed from '../seeds/basic'
|
|
5
|
-
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
6
5
|
|
|
7
6
|
describe('list feed views', () => {
|
|
8
7
|
let network: TestNetwork
|
|
@@ -113,9 +112,9 @@ describe('list feed views', () => {
|
|
|
113
112
|
})
|
|
114
113
|
|
|
115
114
|
it('blocks posts by actor takedown', async () => {
|
|
116
|
-
|
|
115
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
117
116
|
{
|
|
118
|
-
|
|
117
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
119
118
|
subject: {
|
|
120
119
|
$type: 'com.atproto.admin.defs#repoRef',
|
|
121
120
|
did: bob,
|
|
@@ -136,9 +135,13 @@ describe('list feed views', () => {
|
|
|
136
135
|
expect(hasBob).toBe(false)
|
|
137
136
|
|
|
138
137
|
// Cleanup
|
|
139
|
-
await agent.api.com.atproto.admin.
|
|
138
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
140
139
|
{
|
|
141
|
-
|
|
140
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
141
|
+
subject: {
|
|
142
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
143
|
+
did: bob,
|
|
144
|
+
},
|
|
142
145
|
createdBy: 'did:example:admin',
|
|
143
146
|
reason: 'Y',
|
|
144
147
|
},
|
|
@@ -151,9 +154,9 @@ describe('list feed views', () => {
|
|
|
151
154
|
|
|
152
155
|
it('blocks posts by record takedown.', async () => {
|
|
153
156
|
const postRef = sc.replies[bob][0].ref // Post and reply parent
|
|
154
|
-
|
|
157
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
155
158
|
{
|
|
156
|
-
|
|
159
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
157
160
|
subject: {
|
|
158
161
|
$type: 'com.atproto.repo.strongRef',
|
|
159
162
|
uri: postRef.uriStr,
|
|
@@ -177,9 +180,14 @@ describe('list feed views', () => {
|
|
|
177
180
|
expect(hasPost).toBe(false)
|
|
178
181
|
|
|
179
182
|
// Cleanup
|
|
180
|
-
await agent.api.com.atproto.admin.
|
|
183
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
181
184
|
{
|
|
182
|
-
|
|
185
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
186
|
+
subject: {
|
|
187
|
+
$type: 'com.atproto.repo.strongRef',
|
|
188
|
+
uri: postRef.uriStr,
|
|
189
|
+
cid: postRef.cidStr,
|
|
190
|
+
},
|
|
183
191
|
createdBy: 'did:example:admin',
|
|
184
192
|
reason: 'Y',
|
|
185
193
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import AtpAgent from '@atproto/api'
|
|
2
2
|
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
|
-
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
4
3
|
import { forSnapshot, paginateAll } from '../_util'
|
|
5
4
|
import basicSeed from '../seeds/basic'
|
|
6
5
|
import { Notification } from '../../src/lexicon/types/app/bsky/notification/listNotifications'
|
|
@@ -61,7 +60,7 @@ describe('notification views', () => {
|
|
|
61
60
|
{ headers: await network.serviceHeaders(sc.dids.bob) },
|
|
62
61
|
)
|
|
63
62
|
|
|
64
|
-
expect(notifCountBob.data.count).
|
|
63
|
+
expect(notifCountBob.data.count).toBeGreaterThanOrEqual(3)
|
|
65
64
|
})
|
|
66
65
|
|
|
67
66
|
it('generates notifications for all reply ancestors', async () => {
|
|
@@ -89,7 +88,7 @@ describe('notification views', () => {
|
|
|
89
88
|
{ headers: await network.serviceHeaders(sc.dids.bob) },
|
|
90
89
|
)
|
|
91
90
|
|
|
92
|
-
expect(notifCountBob.data.count).
|
|
91
|
+
expect(notifCountBob.data.count).toBeGreaterThanOrEqual(4)
|
|
93
92
|
})
|
|
94
93
|
|
|
95
94
|
it('does not give notifs for a deleted subject', async () => {
|
|
@@ -233,11 +232,11 @@ describe('notification views', () => {
|
|
|
233
232
|
it('fetches notifications omitting mentions and replies for taken-down posts', async () => {
|
|
234
233
|
const postRef1 = sc.replies[sc.dids.carol][0].ref // Reply
|
|
235
234
|
const postRef2 = sc.posts[sc.dids.dan][1].ref // Mention
|
|
236
|
-
|
|
235
|
+
await Promise.all(
|
|
237
236
|
[postRef1, postRef2].map((postRef) =>
|
|
238
|
-
agent.api.com.atproto.admin.
|
|
237
|
+
agent.api.com.atproto.admin.emitModerationEvent(
|
|
239
238
|
{
|
|
240
|
-
|
|
239
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
241
240
|
subject: {
|
|
242
241
|
$type: 'com.atproto.repo.strongRef',
|
|
243
242
|
uri: postRef.uriStr,
|
|
@@ -270,10 +269,15 @@ describe('notification views', () => {
|
|
|
270
269
|
|
|
271
270
|
// Cleanup
|
|
272
271
|
await Promise.all(
|
|
273
|
-
|
|
274
|
-
agent.api.com.atproto.admin.
|
|
272
|
+
[postRef1, postRef2].map((postRef) =>
|
|
273
|
+
agent.api.com.atproto.admin.emitModerationEvent(
|
|
275
274
|
{
|
|
276
|
-
|
|
275
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
276
|
+
subject: {
|
|
277
|
+
$type: 'com.atproto.repo.strongRef',
|
|
278
|
+
uri: postRef.uriStr,
|
|
279
|
+
cid: postRef.cidStr,
|
|
280
|
+
},
|
|
277
281
|
createdBy: 'did:example:admin',
|
|
278
282
|
reason: 'Y',
|
|
279
283
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from 'fs/promises'
|
|
2
2
|
import AtpAgent from '@atproto/api'
|
|
3
3
|
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
4
|
-
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
5
4
|
import { forSnapshot, stripViewer } from '../_util'
|
|
6
5
|
import { ids } from '../../src/lexicon/lexicons'
|
|
7
6
|
import basicSeed from '../seeds/basic'
|
|
@@ -186,22 +185,21 @@ describe('pds profile views', () => {
|
|
|
186
185
|
})
|
|
187
186
|
|
|
188
187
|
it('blocked by actor takedown', async () => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
did: alice,
|
|
196
|
-
},
|
|
197
|
-
createdBy: 'did:example:admin',
|
|
198
|
-
reason: 'Y',
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
encoding: 'application/json',
|
|
202
|
-
headers: network.pds.adminAuthHeaders(),
|
|
188
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
189
|
+
{
|
|
190
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
191
|
+
subject: {
|
|
192
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
193
|
+
did: alice,
|
|
203
194
|
},
|
|
204
|
-
|
|
195
|
+
createdBy: 'did:example:admin',
|
|
196
|
+
reason: 'Y',
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
encoding: 'application/json',
|
|
200
|
+
headers: network.pds.adminAuthHeaders(),
|
|
201
|
+
},
|
|
202
|
+
)
|
|
205
203
|
const promise = agent.api.app.bsky.actor.getProfile(
|
|
206
204
|
{ actor: alice },
|
|
207
205
|
{ headers: await network.serviceHeaders(bob) },
|
|
@@ -210,9 +208,13 @@ describe('pds profile views', () => {
|
|
|
210
208
|
await expect(promise).rejects.toThrow('Account has been taken down')
|
|
211
209
|
|
|
212
210
|
// Cleanup
|
|
213
|
-
await agent.api.com.atproto.admin.
|
|
211
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
214
212
|
{
|
|
215
|
-
|
|
213
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
214
|
+
subject: {
|
|
215
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
216
|
+
did: alice,
|
|
217
|
+
},
|
|
216
218
|
createdBy: 'did:example:admin',
|
|
217
219
|
reason: 'Y',
|
|
218
220
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import AtpAgent, { AppBskyFeedGetPostThread } from '@atproto/api'
|
|
2
2
|
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
3
|
-
import { TAKEDOWN } from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
4
3
|
import { forSnapshot, stripViewerFromThread } from '../_util'
|
|
5
4
|
import basicSeed from '../seeds/basic'
|
|
6
5
|
import assert from 'assert'
|
|
@@ -167,9 +166,9 @@ describe('pds thread views', () => {
|
|
|
167
166
|
describe('takedown', () => {
|
|
168
167
|
it('blocks post by actor', async () => {
|
|
169
168
|
const { data: modAction } =
|
|
170
|
-
await agent.api.com.atproto.admin.
|
|
169
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
171
170
|
{
|
|
172
|
-
|
|
171
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
173
172
|
subject: {
|
|
174
173
|
$type: 'com.atproto.admin.defs#repoRef',
|
|
175
174
|
did: alice,
|
|
@@ -194,9 +193,13 @@ describe('pds thread views', () => {
|
|
|
194
193
|
)
|
|
195
194
|
|
|
196
195
|
// Cleanup
|
|
197
|
-
await agent.api.com.atproto.admin.
|
|
196
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
198
197
|
{
|
|
199
|
-
|
|
198
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
199
|
+
subject: {
|
|
200
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
201
|
+
did: alice,
|
|
202
|
+
},
|
|
200
203
|
createdBy: 'did:example:admin',
|
|
201
204
|
reason: 'Y',
|
|
202
205
|
},
|
|
@@ -209,9 +212,9 @@ describe('pds thread views', () => {
|
|
|
209
212
|
|
|
210
213
|
it('blocks replies by actor', async () => {
|
|
211
214
|
const { data: modAction } =
|
|
212
|
-
await agent.api.com.atproto.admin.
|
|
215
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
213
216
|
{
|
|
214
|
-
|
|
217
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
215
218
|
subject: {
|
|
216
219
|
$type: 'com.atproto.admin.defs#repoRef',
|
|
217
220
|
did: carol,
|
|
@@ -234,9 +237,13 @@ describe('pds thread views', () => {
|
|
|
234
237
|
expect(forSnapshot(thread.data.thread)).toMatchSnapshot()
|
|
235
238
|
|
|
236
239
|
// Cleanup
|
|
237
|
-
await agent.api.com.atproto.admin.
|
|
240
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
238
241
|
{
|
|
239
|
-
|
|
242
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
243
|
+
subject: {
|
|
244
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
245
|
+
did: carol,
|
|
246
|
+
},
|
|
240
247
|
createdBy: 'did:example:admin',
|
|
241
248
|
reason: 'Y',
|
|
242
249
|
},
|
|
@@ -249,9 +256,9 @@ describe('pds thread views', () => {
|
|
|
249
256
|
|
|
250
257
|
it('blocks ancestors by actor', async () => {
|
|
251
258
|
const { data: modAction } =
|
|
252
|
-
await agent.api.com.atproto.admin.
|
|
259
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
253
260
|
{
|
|
254
|
-
|
|
261
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
255
262
|
subject: {
|
|
256
263
|
$type: 'com.atproto.admin.defs#repoRef',
|
|
257
264
|
did: bob,
|
|
@@ -274,9 +281,13 @@ describe('pds thread views', () => {
|
|
|
274
281
|
expect(forSnapshot(thread.data.thread)).toMatchSnapshot()
|
|
275
282
|
|
|
276
283
|
// Cleanup
|
|
277
|
-
await agent.api.com.atproto.admin.
|
|
284
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
278
285
|
{
|
|
279
|
-
|
|
286
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
287
|
+
subject: {
|
|
288
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
289
|
+
did: bob,
|
|
290
|
+
},
|
|
280
291
|
createdBy: 'did:example:admin',
|
|
281
292
|
reason: 'Y',
|
|
282
293
|
},
|
|
@@ -290,9 +301,9 @@ describe('pds thread views', () => {
|
|
|
290
301
|
it('blocks post by record', async () => {
|
|
291
302
|
const postRef = sc.posts[alice][1].ref
|
|
292
303
|
const { data: modAction } =
|
|
293
|
-
await agent.api.com.atproto.admin.
|
|
304
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
294
305
|
{
|
|
295
|
-
|
|
306
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
296
307
|
subject: {
|
|
297
308
|
$type: 'com.atproto.repo.strongRef',
|
|
298
309
|
uri: postRef.uriStr,
|
|
@@ -317,9 +328,14 @@ describe('pds thread views', () => {
|
|
|
317
328
|
)
|
|
318
329
|
|
|
319
330
|
// Cleanup
|
|
320
|
-
await agent.api.com.atproto.admin.
|
|
331
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
321
332
|
{
|
|
322
|
-
|
|
333
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
334
|
+
subject: {
|
|
335
|
+
$type: 'com.atproto.repo.strongRef',
|
|
336
|
+
uri: postRef.uriStr,
|
|
337
|
+
cid: postRef.cidStr,
|
|
338
|
+
},
|
|
323
339
|
createdBy: 'did:example:admin',
|
|
324
340
|
reason: 'Y',
|
|
325
341
|
},
|
|
@@ -339,9 +355,9 @@ describe('pds thread views', () => {
|
|
|
339
355
|
const parent = threadPreTakedown.data.thread.parent?.['post']
|
|
340
356
|
|
|
341
357
|
const { data: modAction } =
|
|
342
|
-
await agent.api.com.atproto.admin.
|
|
358
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
343
359
|
{
|
|
344
|
-
|
|
360
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
345
361
|
subject: {
|
|
346
362
|
$type: 'com.atproto.repo.strongRef',
|
|
347
363
|
uri: parent.uri,
|
|
@@ -365,9 +381,14 @@ describe('pds thread views', () => {
|
|
|
365
381
|
expect(forSnapshot(thread.data.thread)).toMatchSnapshot()
|
|
366
382
|
|
|
367
383
|
// Cleanup
|
|
368
|
-
await agent.api.com.atproto.admin.
|
|
384
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
369
385
|
{
|
|
370
|
-
|
|
386
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
387
|
+
subject: {
|
|
388
|
+
$type: 'com.atproto.repo.strongRef',
|
|
389
|
+
uri: parent.uri,
|
|
390
|
+
cid: parent.cid,
|
|
391
|
+
},
|
|
371
392
|
createdBy: 'did:example:admin',
|
|
372
393
|
reason: 'Y',
|
|
373
394
|
},
|
|
@@ -388,9 +409,9 @@ describe('pds thread views', () => {
|
|
|
388
409
|
|
|
389
410
|
const actionResults = await Promise.all(
|
|
390
411
|
[post1, post2].map((post) =>
|
|
391
|
-
agent.api.com.atproto.admin.
|
|
412
|
+
agent.api.com.atproto.admin.emitModerationEvent(
|
|
392
413
|
{
|
|
393
|
-
|
|
414
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
394
415
|
subject: {
|
|
395
416
|
$type: 'com.atproto.repo.strongRef',
|
|
396
417
|
uri: post.uri,
|
|
@@ -417,10 +438,17 @@ describe('pds thread views', () => {
|
|
|
417
438
|
|
|
418
439
|
// Cleanup
|
|
419
440
|
await Promise.all(
|
|
420
|
-
|
|
421
|
-
agent.api.com.atproto.admin.
|
|
441
|
+
[post1, post2].map((post) =>
|
|
442
|
+
agent.api.com.atproto.admin.emitModerationEvent(
|
|
422
443
|
{
|
|
423
|
-
|
|
444
|
+
event: {
|
|
445
|
+
$type: 'com.atproto.admin.defs#modEventReverseTakedown',
|
|
446
|
+
},
|
|
447
|
+
subject: {
|
|
448
|
+
$type: 'com.atproto.repo.strongRef',
|
|
449
|
+
uri: post.uri,
|
|
450
|
+
cid: post.cid,
|
|
451
|
+
},
|
|
424
452
|
createdBy: 'did:example:admin',
|
|
425
453
|
reason: 'Y',
|
|
426
454
|
},
|