@atproto/bsky 0.0.15 → 0.0.17
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 +18 -0
- package/dist/api/com/atproto/moderation/util.d.ts +4 -3
- package/dist/cache/read-through.d.ts +30 -0
- package/dist/config.d.ts +18 -0
- package/dist/context.d.ts +21 -6
- package/dist/daemon/config.d.ts +15 -0
- package/dist/daemon/context.d.ts +15 -0
- package/dist/daemon/index.d.ts +23 -0
- package/dist/daemon/logger.d.ts +3 -0
- package/dist/daemon/notifications.d.ts +18 -0
- package/dist/daemon/services.d.ts +11 -0
- package/dist/db/database-schema.d.ts +1 -2
- package/dist/db/index.js +41 -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/20231205T000257238Z-remove-did-cache.d.ts +3 -0
- package/dist/db/migrations/index.d.ts +2 -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/did-cache.d.ts +10 -7
- package/dist/feed-gen/types.d.ts +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +4370 -2758
- package/dist/index.js.map +3 -3
- package/dist/indexer/context.d.ts +2 -0
- package/dist/indexer/index.d.ts +1 -0
- package/dist/lexicon/index.d.ts +23 -18
- package/dist/lexicon/lexicons.d.ts +561 -412
- 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/{resolveModerationReports.d.ts → deleteAccount.d.ts} +2 -13
- 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/lexicon/types/com/atproto/{admin/getModerationReport.d.ts → temp/importRepo.d.ts} +10 -7
- package/dist/lexicon/types/com/atproto/temp/pushBlob.d.ts +25 -0
- package/dist/lexicon/types/com/atproto/{admin/reverseModerationAction.d.ts → temp/transferAccount.d.ts} +11 -5
- package/dist/logger.d.ts +1 -0
- package/dist/migrate-moderation-data.d.ts +1 -0
- package/dist/redis.d.ts +10 -1
- package/dist/services/actor/index.d.ts +18 -4
- package/dist/services/actor/views.d.ts +6 -8
- package/dist/services/feed/index.d.ts +7 -4
- package/dist/services/feed/util.d.ts +9 -1
- package/dist/services/feed/views.d.ts +11 -21
- package/dist/services/graph/index.d.ts +5 -29
- package/dist/services/graph/types.d.ts +1 -0
- package/dist/services/index.d.ts +3 -7
- package/dist/services/label/index.d.ts +10 -4
- package/dist/services/moderation/index.d.ts +134 -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/services/types.d.ts +3 -0
- package/dist/services/util/notification.d.ts +5 -0
- package/dist/services/util/post.d.ts +6 -6
- package/dist/util/debug.d.ts +1 -1
- package/dist/util/retry.d.ts +1 -6
- 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/cache/read-through.ts +151 -0
- package/src/config.ts +90 -1
- package/src/context.ts +11 -7
- package/src/daemon/config.ts +60 -0
- package/src/daemon/context.ts +27 -0
- package/src/daemon/index.ts +78 -0
- package/src/daemon/logger.ts +6 -0
- package/src/daemon/notifications.ts +54 -0
- package/src/daemon/services.ts +22 -0
- package/src/db/database-schema.ts +0 -2
- package/src/db/migrations/20231003T202833377Z-create-moderation-subject-status.ts +123 -0
- package/src/db/migrations/20231205T000257238Z-remove-did-cache.ts +14 -0
- package/src/db/migrations/index.ts +2 -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/did-cache.ts +33 -56
- package/src/feed-gen/bsky-team.ts +1 -1
- package/src/feed-gen/hot-classic.ts +1 -1
- package/src/feed-gen/index.ts +0 -4
- package/src/feed-gen/mutuals.ts +6 -2
- package/src/feed-gen/types.ts +1 -1
- package/src/index.ts +57 -17
- package/src/indexer/context.ts +5 -0
- package/src/indexer/index.ts +10 -7
- package/src/lexicon/index.ts +80 -67
- package/src/lexicon/lexicons.ts +698 -507
- 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/{resolveModerationReports.ts → deleteAccount.ts} +2 -13
- 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/lexicon/types/com/atproto/{admin/getModerationAction.ts → temp/importRepo.ts} +11 -7
- package/src/lexicon/types/com/atproto/temp/pushBlob.ts +39 -0
- package/src/lexicon/types/com/atproto/{admin/reverseModerationAction.ts → temp/transferAccount.ts} +18 -5
- package/src/logger.ts +2 -0
- package/src/migrate-moderation-data.ts +414 -0
- package/src/redis.ts +43 -3
- package/src/services/actor/index.ts +55 -7
- package/src/services/actor/views.ts +18 -21
- package/src/services/feed/index.ts +52 -19
- package/src/services/feed/util.ts +47 -19
- package/src/services/feed/views.ts +87 -13
- package/src/services/graph/index.ts +21 -3
- package/src/services/graph/types.ts +1 -0
- package/src/services/index.ts +14 -14
- package/src/services/indexing/index.ts +7 -10
- 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 +16 -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 +68 -25
- package/src/services/moderation/index.ts +380 -395
- package/src/services/moderation/pagination.ts +96 -0
- package/src/services/moderation/status.ts +241 -0
- package/src/services/moderation/types.ts +49 -0
- package/src/services/moderation/views.ts +278 -329
- package/src/services/types.ts +4 -0
- package/src/services/util/notification.ts +70 -0
- package/src/util/debug.ts +2 -2
- package/src/util/retry.ts +1 -44
- 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 +10 -12
- 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 +3 -3
- package/tests/algos/hot-classic.test.ts +1 -2
- package/tests/auth.test.ts +1 -1
- package/tests/auto-moderator/fuzzy-matcher.test.ts +2 -1
- package/tests/auto-moderator/labeler.test.ts +19 -20
- package/tests/auto-moderator/takedowns.test.ts +61 -28
- package/tests/blob-resolver.test.ts +4 -2
- package/tests/daemon.test.ts +191 -0
- package/tests/did-cache.test.ts +20 -5
- package/tests/feed-generation.test.ts +57 -9
- package/tests/handle-invalidation.test.ts +1 -5
- package/tests/indexing.test.ts +20 -13
- package/tests/redis-cache.test.ts +231 -0
- package/tests/seeds/basic.ts +3 -0
- package/tests/subscription/repo.test.ts +4 -7
- 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 -19
- package/tests/views/thread.test.ts +117 -94
- package/tests/views/threadgating.test.ts +89 -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/db/tables/did-cache.d.ts +0 -10
- package/dist/feed-gen/best-of-follows.d.ts +0 -29
- package/dist/feed-gen/whats-hot.d.ts +0 -29
- package/dist/feed-gen/with-friends.d.ts +0 -3
- package/dist/label-cache.d.ts +0 -19
- 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/db/tables/did-cache.ts +0 -13
- package/src/feed-gen/best-of-follows.ts +0 -74
- package/src/feed-gen/whats-hot.ts +0 -101
- package/src/feed-gen/with-friends.ts +0 -39
- package/src/label-cache.ts +0 -90
- 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/tests/algos/whats-hot.test.ts +0 -118
- package/tests/algos/with-friends.test.ts +0 -145
- /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, 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
|
import { isRecord } from '../../src/lexicon/types/app/bsky/feed/post'
|
|
7
6
|
import { isView as isEmbedRecordWithMedia } from '../../src/lexicon/types/app/bsky/embed/recordWithMedia'
|
|
8
7
|
import { isView as isImageEmbed } from '../../src/lexicon/types/app/bsky/embed/images'
|
|
@@ -146,22 +145,21 @@ describe('pds author feed views', () => {
|
|
|
146
145
|
|
|
147
146
|
expect(preBlock.feed.length).toBeGreaterThan(0)
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
{
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
did: alice,
|
|
156
|
-
},
|
|
157
|
-
createdBy: 'did:example:admin',
|
|
158
|
-
reason: 'Y',
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
encoding: 'application/json',
|
|
162
|
-
headers: network.pds.adminAuthHeaders(),
|
|
148
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
149
|
+
{
|
|
150
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
151
|
+
subject: {
|
|
152
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
153
|
+
did: alice,
|
|
163
154
|
},
|
|
164
|
-
|
|
155
|
+
createdBy: 'did:example:admin',
|
|
156
|
+
reason: 'Y',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
encoding: 'application/json',
|
|
160
|
+
headers: network.pds.adminAuthHeaders(),
|
|
161
|
+
},
|
|
162
|
+
)
|
|
165
163
|
|
|
166
164
|
const attempt = agent.api.app.bsky.feed.getAuthorFeed(
|
|
167
165
|
{ actor: alice },
|
|
@@ -170,9 +168,13 @@ describe('pds author feed views', () => {
|
|
|
170
168
|
await expect(attempt).rejects.toThrow('Profile not found')
|
|
171
169
|
|
|
172
170
|
// Cleanup
|
|
173
|
-
await agent.api.com.atproto.admin.
|
|
171
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
174
172
|
{
|
|
175
|
-
|
|
173
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
174
|
+
subject: {
|
|
175
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
176
|
+
did: alice,
|
|
177
|
+
},
|
|
176
178
|
createdBy: 'did:example:admin',
|
|
177
179
|
reason: 'Y',
|
|
178
180
|
},
|
|
@@ -193,23 +195,22 @@ describe('pds author feed views', () => {
|
|
|
193
195
|
|
|
194
196
|
const post = preBlock.feed[0].post
|
|
195
197
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
{
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
cid: post.cid,
|
|
204
|
-
},
|
|
205
|
-
createdBy: 'did:example:admin',
|
|
206
|
-
reason: 'Y',
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
encoding: 'application/json',
|
|
210
|
-
headers: network.pds.adminAuthHeaders(),
|
|
198
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
199
|
+
{
|
|
200
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
201
|
+
subject: {
|
|
202
|
+
$type: 'com.atproto.repo.strongRef',
|
|
203
|
+
uri: post.uri,
|
|
204
|
+
cid: post.cid,
|
|
211
205
|
},
|
|
212
|
-
|
|
206
|
+
createdBy: 'did:example:admin',
|
|
207
|
+
reason: 'Y',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
encoding: 'application/json',
|
|
211
|
+
headers: network.pds.adminAuthHeaders(),
|
|
212
|
+
},
|
|
213
|
+
)
|
|
213
214
|
|
|
214
215
|
const { data: postBlock } = await agent.api.app.bsky.feed.getAuthorFeed(
|
|
215
216
|
{ actor: alice },
|
|
@@ -220,9 +221,14 @@ describe('pds author feed views', () => {
|
|
|
220
221
|
expect(postBlock.feed.map((item) => item.post.uri)).not.toContain(post.uri)
|
|
221
222
|
|
|
222
223
|
// Cleanup
|
|
223
|
-
await agent.api.com.atproto.admin.
|
|
224
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
224
225
|
{
|
|
225
|
-
|
|
226
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
227
|
+
subject: {
|
|
228
|
+
$type: 'com.atproto.repo.strongRef',
|
|
229
|
+
uri: post.uri,
|
|
230
|
+
cid: post.cid,
|
|
231
|
+
},
|
|
226
232
|
createdBy: 'did:example:admin',
|
|
227
233
|
reason: 'Y',
|
|
228
234
|
},
|
|
@@ -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'
|
|
@@ -26,7 +25,6 @@ describe('pds profile views', () => {
|
|
|
26
25
|
sc = network.getSeedClient()
|
|
27
26
|
await basicSeed(sc)
|
|
28
27
|
await network.processAll()
|
|
29
|
-
await network.bsky.processAll()
|
|
30
28
|
alice = sc.dids.alice
|
|
31
29
|
bob = sc.dids.bob
|
|
32
30
|
dan = sc.dids.dan
|
|
@@ -186,22 +184,21 @@ describe('pds profile views', () => {
|
|
|
186
184
|
})
|
|
187
185
|
|
|
188
186
|
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(),
|
|
187
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
188
|
+
{
|
|
189
|
+
event: { $type: 'com.atproto.admin.defs#modEventTakedown' },
|
|
190
|
+
subject: {
|
|
191
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
192
|
+
did: alice,
|
|
203
193
|
},
|
|
204
|
-
|
|
194
|
+
createdBy: 'did:example:admin',
|
|
195
|
+
reason: 'Y',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
encoding: 'application/json',
|
|
199
|
+
headers: network.pds.adminAuthHeaders(),
|
|
200
|
+
},
|
|
201
|
+
)
|
|
205
202
|
const promise = agent.api.app.bsky.actor.getProfile(
|
|
206
203
|
{ actor: alice },
|
|
207
204
|
{ headers: await network.serviceHeaders(bob) },
|
|
@@ -210,9 +207,13 @@ describe('pds profile views', () => {
|
|
|
210
207
|
await expect(promise).rejects.toThrow('Account has been taken down')
|
|
211
208
|
|
|
212
209
|
// Cleanup
|
|
213
|
-
await agent.api.com.atproto.admin.
|
|
210
|
+
await agent.api.com.atproto.admin.emitModerationEvent(
|
|
214
211
|
{
|
|
215
|
-
|
|
212
|
+
event: { $type: 'com.atproto.admin.defs#modEventReverseTakedown' },
|
|
213
|
+
subject: {
|
|
214
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
215
|
+
did: alice,
|
|
216
|
+
},
|
|
216
217
|
createdBy: 'did:example:admin',
|
|
217
218
|
reason: 'Y',
|
|
218
219
|
},
|