@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
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`admin get moderation action view gets moderation report for a record. 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
6
|
-
"id": 2,
|
|
7
|
-
"reason": "defamation",
|
|
8
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
9
|
-
"reportedBy": "user(0)",
|
|
10
|
-
"resolvedByActions": Array [
|
|
11
|
-
Object {
|
|
12
|
-
"action": "com.atproto.admin.defs#takedown",
|
|
13
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
14
|
-
"createdBy": "did:example:admin",
|
|
15
|
-
"id": 2,
|
|
16
|
-
"reason": "X",
|
|
17
|
-
"resolvedReportIds": Array [
|
|
18
|
-
2,
|
|
19
|
-
],
|
|
20
|
-
"subject": Object {
|
|
21
|
-
"$type": "com.atproto.repo.strongRef",
|
|
22
|
-
"cid": "cids(0)",
|
|
23
|
-
"uri": "record(0)",
|
|
24
|
-
},
|
|
25
|
-
"subjectBlobCids": Array [],
|
|
26
|
-
},
|
|
27
|
-
Object {
|
|
28
|
-
"action": "com.atproto.admin.defs#flag",
|
|
29
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
30
|
-
"createdBy": "did:example:admin",
|
|
31
|
-
"id": 1,
|
|
32
|
-
"reason": "X",
|
|
33
|
-
"resolvedReportIds": Array [
|
|
34
|
-
2,
|
|
35
|
-
1,
|
|
36
|
-
],
|
|
37
|
-
"reversal": Object {
|
|
38
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
39
|
-
"createdBy": "did:example:admin",
|
|
40
|
-
"reason": "X",
|
|
41
|
-
},
|
|
42
|
-
"subject": Object {
|
|
43
|
-
"$type": "com.atproto.admin.defs#repoRef",
|
|
44
|
-
"did": "user(1)",
|
|
45
|
-
},
|
|
46
|
-
"subjectBlobCids": Array [],
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
"subject": Object {
|
|
50
|
-
"$type": "com.atproto.admin.defs#recordView",
|
|
51
|
-
"blobCids": Array [],
|
|
52
|
-
"cid": "cids(0)",
|
|
53
|
-
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
54
|
-
"moderation": Object {
|
|
55
|
-
"currentAction": Object {
|
|
56
|
-
"action": "com.atproto.admin.defs#takedown",
|
|
57
|
-
"id": 2,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
"repo": Object {
|
|
61
|
-
"did": "user(1)",
|
|
62
|
-
"email": "alice@test.com",
|
|
63
|
-
"handle": "alice.test",
|
|
64
|
-
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
65
|
-
"invitesDisabled": false,
|
|
66
|
-
"moderation": Object {},
|
|
67
|
-
"relatedRecords": Array [
|
|
68
|
-
Object {
|
|
69
|
-
"$type": "app.bsky.actor.profile",
|
|
70
|
-
"avatar": Object {
|
|
71
|
-
"$type": "blob",
|
|
72
|
-
"mimeType": "image/jpeg",
|
|
73
|
-
"ref": Object {
|
|
74
|
-
"$link": "cids(1)",
|
|
75
|
-
},
|
|
76
|
-
"size": 3976,
|
|
77
|
-
},
|
|
78
|
-
"description": "its me!",
|
|
79
|
-
"displayName": "ali",
|
|
80
|
-
"labels": Object {
|
|
81
|
-
"$type": "com.atproto.label.defs#selfLabels",
|
|
82
|
-
"values": Array [
|
|
83
|
-
Object {
|
|
84
|
-
"val": "self-label-a",
|
|
85
|
-
},
|
|
86
|
-
Object {
|
|
87
|
-
"val": "self-label-b",
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
"uri": "record(0)",
|
|
95
|
-
"value": Object {
|
|
96
|
-
"$type": "app.bsky.feed.post",
|
|
97
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
98
|
-
"labels": Object {
|
|
99
|
-
"$type": "com.atproto.label.defs#selfLabels",
|
|
100
|
-
"values": Array [
|
|
101
|
-
Object {
|
|
102
|
-
"val": "self-label",
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
"text": "hey there",
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
}
|
|
110
|
-
`;
|
|
111
|
-
|
|
112
|
-
exports[`admin get moderation action view gets moderation report for a repo. 1`] = `
|
|
113
|
-
Object {
|
|
114
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
115
|
-
"id": 1,
|
|
116
|
-
"reasonType": "com.atproto.moderation.defs#reasonSpam",
|
|
117
|
-
"reportedBy": "user(0)",
|
|
118
|
-
"resolvedByActions": Array [
|
|
119
|
-
Object {
|
|
120
|
-
"action": "com.atproto.admin.defs#flag",
|
|
121
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
122
|
-
"createdBy": "did:example:admin",
|
|
123
|
-
"id": 1,
|
|
124
|
-
"reason": "X",
|
|
125
|
-
"resolvedReportIds": Array [
|
|
126
|
-
2,
|
|
127
|
-
1,
|
|
128
|
-
],
|
|
129
|
-
"reversal": Object {
|
|
130
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
131
|
-
"createdBy": "did:example:admin",
|
|
132
|
-
"reason": "X",
|
|
133
|
-
},
|
|
134
|
-
"subject": Object {
|
|
135
|
-
"$type": "com.atproto.admin.defs#repoRef",
|
|
136
|
-
"did": "user(1)",
|
|
137
|
-
},
|
|
138
|
-
"subjectBlobCids": Array [],
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
"subject": Object {
|
|
142
|
-
"$type": "com.atproto.admin.defs#repoView",
|
|
143
|
-
"did": "user(1)",
|
|
144
|
-
"email": "alice@test.com",
|
|
145
|
-
"handle": "alice.test",
|
|
146
|
-
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
147
|
-
"invitesDisabled": false,
|
|
148
|
-
"moderation": Object {},
|
|
149
|
-
"relatedRecords": Array [
|
|
150
|
-
Object {
|
|
151
|
-
"$type": "app.bsky.actor.profile",
|
|
152
|
-
"avatar": Object {
|
|
153
|
-
"$type": "blob",
|
|
154
|
-
"mimeType": "image/jpeg",
|
|
155
|
-
"ref": Object {
|
|
156
|
-
"$link": "cids(0)",
|
|
157
|
-
},
|
|
158
|
-
"size": 3976,
|
|
159
|
-
},
|
|
160
|
-
"description": "its me!",
|
|
161
|
-
"displayName": "ali",
|
|
162
|
-
"labels": Object {
|
|
163
|
-
"$type": "com.atproto.label.defs#selfLabels",
|
|
164
|
-
"values": Array [
|
|
165
|
-
Object {
|
|
166
|
-
"val": "self-label-a",
|
|
167
|
-
},
|
|
168
|
-
Object {
|
|
169
|
-
"val": "self-label-b",
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
],
|
|
175
|
-
},
|
|
176
|
-
}
|
|
177
|
-
`;
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`admin get moderation reports view gets all moderation reports actioned by a certain moderator. 1`] = `
|
|
4
|
-
Array [
|
|
5
|
-
Object {
|
|
6
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
7
|
-
"id": 1,
|
|
8
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
9
|
-
"reportedBy": "user(0)",
|
|
10
|
-
"resolvedByActionIds": Array [
|
|
11
|
-
1,
|
|
12
|
-
],
|
|
13
|
-
"subject": Object {
|
|
14
|
-
"$type": "com.atproto.repo.strongRef",
|
|
15
|
-
"cid": "cids(0)",
|
|
16
|
-
"uri": "record(0)",
|
|
17
|
-
},
|
|
18
|
-
"subjectRepoHandle": "alice.test",
|
|
19
|
-
},
|
|
20
|
-
]
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
exports[`admin get moderation reports view gets all moderation reports actioned by a certain moderator. 2`] = `
|
|
24
|
-
Array [
|
|
25
|
-
Object {
|
|
26
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
27
|
-
"id": 3,
|
|
28
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
29
|
-
"reportedBy": "user(0)",
|
|
30
|
-
"resolvedByActionIds": Array [
|
|
31
|
-
3,
|
|
32
|
-
],
|
|
33
|
-
"subject": Object {
|
|
34
|
-
"$type": "com.atproto.repo.strongRef",
|
|
35
|
-
"cid": "cids(0)",
|
|
36
|
-
"uri": "record(0)",
|
|
37
|
-
},
|
|
38
|
-
"subjectRepoHandle": "bob.test",
|
|
39
|
-
},
|
|
40
|
-
]
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
exports[`admin get moderation reports view gets all moderation reports by active resolution action type. 1`] = `
|
|
44
|
-
Array [
|
|
45
|
-
Object {
|
|
46
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
47
|
-
"id": 3,
|
|
48
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
49
|
-
"reportedBy": "user(0)",
|
|
50
|
-
"resolvedByActionIds": Array [
|
|
51
|
-
3,
|
|
52
|
-
],
|
|
53
|
-
"subject": Object {
|
|
54
|
-
"$type": "com.atproto.repo.strongRef",
|
|
55
|
-
"cid": "cids(0)",
|
|
56
|
-
"uri": "record(0)",
|
|
57
|
-
},
|
|
58
|
-
"subjectRepoHandle": "bob.test",
|
|
59
|
-
},
|
|
60
|
-
]
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
exports[`admin get moderation reports view gets all moderation reports for a record. 1`] = `
|
|
64
|
-
Array [
|
|
65
|
-
Object {
|
|
66
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
67
|
-
"id": 1,
|
|
68
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
69
|
-
"reportedBy": "user(0)",
|
|
70
|
-
"resolvedByActionIds": Array [
|
|
71
|
-
1,
|
|
72
|
-
],
|
|
73
|
-
"subject": Object {
|
|
74
|
-
"$type": "com.atproto.repo.strongRef",
|
|
75
|
-
"cid": "cids(0)",
|
|
76
|
-
"uri": "record(0)",
|
|
77
|
-
},
|
|
78
|
-
"subjectRepoHandle": "alice.test",
|
|
79
|
-
},
|
|
80
|
-
]
|
|
81
|
-
`;
|
|
82
|
-
|
|
83
|
-
exports[`admin get moderation reports view gets all moderation reports for a repo. 1`] = `
|
|
84
|
-
Array [
|
|
85
|
-
Object {
|
|
86
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
87
|
-
"id": 5,
|
|
88
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
89
|
-
"reportedBy": "user(0)",
|
|
90
|
-
"resolvedByActionIds": Array [
|
|
91
|
-
5,
|
|
92
|
-
],
|
|
93
|
-
"subject": Object {
|
|
94
|
-
"$type": "com.atproto.admin.defs#repoRef",
|
|
95
|
-
"did": "user(0)",
|
|
96
|
-
},
|
|
97
|
-
"subjectRepoHandle": "alice.test",
|
|
98
|
-
},
|
|
99
|
-
Object {
|
|
100
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
101
|
-
"id": 2,
|
|
102
|
-
"reasonType": "com.atproto.moderation.defs#reasonSpam",
|
|
103
|
-
"reportedBy": "user(1)",
|
|
104
|
-
"resolvedByActionIds": Array [],
|
|
105
|
-
"subject": Object {
|
|
106
|
-
"$type": "com.atproto.repo.strongRef",
|
|
107
|
-
"cid": "cids(0)",
|
|
108
|
-
"uri": "record(0)",
|
|
109
|
-
},
|
|
110
|
-
"subjectRepoHandle": "alice.test",
|
|
111
|
-
},
|
|
112
|
-
Object {
|
|
113
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
114
|
-
"id": 1,
|
|
115
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
116
|
-
"reportedBy": "user(0)",
|
|
117
|
-
"resolvedByActionIds": Array [
|
|
118
|
-
1,
|
|
119
|
-
],
|
|
120
|
-
"subject": Object {
|
|
121
|
-
"$type": "com.atproto.repo.strongRef",
|
|
122
|
-
"cid": "cids(1)",
|
|
123
|
-
"uri": "record(1)",
|
|
124
|
-
},
|
|
125
|
-
"subjectRepoHandle": "alice.test",
|
|
126
|
-
},
|
|
127
|
-
]
|
|
128
|
-
`;
|
|
129
|
-
|
|
130
|
-
exports[`admin get moderation reports view gets all moderation reports. 1`] = `
|
|
131
|
-
Array [
|
|
132
|
-
Object {
|
|
133
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
134
|
-
"id": 6,
|
|
135
|
-
"reasonType": "com.atproto.moderation.defs#reasonSpam",
|
|
136
|
-
"reportedBy": "user(0)",
|
|
137
|
-
"resolvedByActionIds": Array [],
|
|
138
|
-
"subject": Object {
|
|
139
|
-
"$type": "com.atproto.admin.defs#repoRef",
|
|
140
|
-
"did": "user(0)",
|
|
141
|
-
},
|
|
142
|
-
"subjectRepoHandle": "carol.test",
|
|
143
|
-
},
|
|
144
|
-
Object {
|
|
145
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
146
|
-
"id": 5,
|
|
147
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
148
|
-
"reportedBy": "user(1)",
|
|
149
|
-
"resolvedByActionIds": Array [
|
|
150
|
-
5,
|
|
151
|
-
],
|
|
152
|
-
"subject": Object {
|
|
153
|
-
"$type": "com.atproto.admin.defs#repoRef",
|
|
154
|
-
"did": "user(1)",
|
|
155
|
-
},
|
|
156
|
-
"subjectRepoHandle": "alice.test",
|
|
157
|
-
},
|
|
158
|
-
Object {
|
|
159
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
160
|
-
"id": 4,
|
|
161
|
-
"reasonType": "com.atproto.moderation.defs#reasonSpam",
|
|
162
|
-
"reportedBy": "user(0)",
|
|
163
|
-
"resolvedByActionIds": Array [],
|
|
164
|
-
"subject": Object {
|
|
165
|
-
"$type": "com.atproto.repo.strongRef",
|
|
166
|
-
"cid": "cids(0)",
|
|
167
|
-
"uri": "record(0)",
|
|
168
|
-
},
|
|
169
|
-
"subjectRepoHandle": "dan.test",
|
|
170
|
-
},
|
|
171
|
-
Object {
|
|
172
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
173
|
-
"id": 3,
|
|
174
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
175
|
-
"reportedBy": "user(1)",
|
|
176
|
-
"resolvedByActionIds": Array [
|
|
177
|
-
3,
|
|
178
|
-
],
|
|
179
|
-
"subject": Object {
|
|
180
|
-
"$type": "com.atproto.repo.strongRef",
|
|
181
|
-
"cid": "cids(1)",
|
|
182
|
-
"uri": "record(1)",
|
|
183
|
-
},
|
|
184
|
-
"subjectRepoHandle": "bob.test",
|
|
185
|
-
},
|
|
186
|
-
Object {
|
|
187
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
188
|
-
"id": 2,
|
|
189
|
-
"reasonType": "com.atproto.moderation.defs#reasonSpam",
|
|
190
|
-
"reportedBy": "user(0)",
|
|
191
|
-
"resolvedByActionIds": Array [],
|
|
192
|
-
"subject": Object {
|
|
193
|
-
"$type": "com.atproto.repo.strongRef",
|
|
194
|
-
"cid": "cids(2)",
|
|
195
|
-
"uri": "record(2)",
|
|
196
|
-
},
|
|
197
|
-
"subjectRepoHandle": "alice.test",
|
|
198
|
-
},
|
|
199
|
-
Object {
|
|
200
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
201
|
-
"id": 1,
|
|
202
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
203
|
-
"reportedBy": "user(1)",
|
|
204
|
-
"resolvedByActionIds": Array [
|
|
205
|
-
1,
|
|
206
|
-
],
|
|
207
|
-
"subject": Object {
|
|
208
|
-
"$type": "com.atproto.repo.strongRef",
|
|
209
|
-
"cid": "cids(3)",
|
|
210
|
-
"uri": "record(3)",
|
|
211
|
-
},
|
|
212
|
-
"subjectRepoHandle": "alice.test",
|
|
213
|
-
},
|
|
214
|
-
]
|
|
215
|
-
`;
|
|
216
|
-
|
|
217
|
-
exports[`admin get moderation reports view gets all resolved/unresolved moderation reports. 1`] = `
|
|
218
|
-
Array [
|
|
219
|
-
Object {
|
|
220
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
221
|
-
"id": 5,
|
|
222
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
223
|
-
"reportedBy": "user(0)",
|
|
224
|
-
"resolvedByActionIds": Array [
|
|
225
|
-
5,
|
|
226
|
-
],
|
|
227
|
-
"subject": Object {
|
|
228
|
-
"$type": "com.atproto.admin.defs#repoRef",
|
|
229
|
-
"did": "user(0)",
|
|
230
|
-
},
|
|
231
|
-
"subjectRepoHandle": "alice.test",
|
|
232
|
-
},
|
|
233
|
-
Object {
|
|
234
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
235
|
-
"id": 3,
|
|
236
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
237
|
-
"reportedBy": "user(0)",
|
|
238
|
-
"resolvedByActionIds": Array [
|
|
239
|
-
3,
|
|
240
|
-
],
|
|
241
|
-
"subject": Object {
|
|
242
|
-
"$type": "com.atproto.repo.strongRef",
|
|
243
|
-
"cid": "cids(0)",
|
|
244
|
-
"uri": "record(0)",
|
|
245
|
-
},
|
|
246
|
-
"subjectRepoHandle": "bob.test",
|
|
247
|
-
},
|
|
248
|
-
Object {
|
|
249
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
250
|
-
"id": 1,
|
|
251
|
-
"reasonType": "com.atproto.moderation.defs#reasonOther",
|
|
252
|
-
"reportedBy": "user(0)",
|
|
253
|
-
"resolvedByActionIds": Array [
|
|
254
|
-
1,
|
|
255
|
-
],
|
|
256
|
-
"subject": Object {
|
|
257
|
-
"$type": "com.atproto.repo.strongRef",
|
|
258
|
-
"cid": "cids(1)",
|
|
259
|
-
"uri": "record(1)",
|
|
260
|
-
},
|
|
261
|
-
"subjectRepoHandle": "alice.test",
|
|
262
|
-
},
|
|
263
|
-
]
|
|
264
|
-
`;
|
|
265
|
-
|
|
266
|
-
exports[`admin get moderation reports view gets all resolved/unresolved moderation reports. 2`] = `
|
|
267
|
-
Array [
|
|
268
|
-
Object {
|
|
269
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
270
|
-
"id": 6,
|
|
271
|
-
"reasonType": "com.atproto.moderation.defs#reasonSpam",
|
|
272
|
-
"reportedBy": "user(0)",
|
|
273
|
-
"resolvedByActionIds": Array [],
|
|
274
|
-
"subject": Object {
|
|
275
|
-
"$type": "com.atproto.admin.defs#repoRef",
|
|
276
|
-
"did": "user(0)",
|
|
277
|
-
},
|
|
278
|
-
"subjectRepoHandle": "carol.test",
|
|
279
|
-
},
|
|
280
|
-
Object {
|
|
281
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
282
|
-
"id": 4,
|
|
283
|
-
"reasonType": "com.atproto.moderation.defs#reasonSpam",
|
|
284
|
-
"reportedBy": "user(0)",
|
|
285
|
-
"resolvedByActionIds": Array [],
|
|
286
|
-
"subject": Object {
|
|
287
|
-
"$type": "com.atproto.repo.strongRef",
|
|
288
|
-
"cid": "cids(0)",
|
|
289
|
-
"uri": "record(0)",
|
|
290
|
-
},
|
|
291
|
-
"subjectRepoHandle": "dan.test",
|
|
292
|
-
},
|
|
293
|
-
Object {
|
|
294
|
-
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
295
|
-
"id": 2,
|
|
296
|
-
"reasonType": "com.atproto.moderation.defs#reasonSpam",
|
|
297
|
-
"reportedBy": "user(0)",
|
|
298
|
-
"resolvedByActionIds": Array [],
|
|
299
|
-
"subject": Object {
|
|
300
|
-
"$type": "com.atproto.repo.strongRef",
|
|
301
|
-
"cid": "cids(1)",
|
|
302
|
-
"uri": "record(1)",
|
|
303
|
-
},
|
|
304
|
-
"subjectRepoHandle": "alice.test",
|
|
305
|
-
},
|
|
306
|
-
]
|
|
307
|
-
`;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { TestNetwork, SeedClient } from '@atproto/dev-env'
|
|
2
|
-
import AtpAgent from '@atproto/api'
|
|
3
|
-
import {
|
|
4
|
-
FLAG,
|
|
5
|
-
TAKEDOWN,
|
|
6
|
-
} from '@atproto/api/src/client/types/com/atproto/admin/defs'
|
|
7
|
-
import {
|
|
8
|
-
REASONOTHER,
|
|
9
|
-
REASONSPAM,
|
|
10
|
-
} from '../../src/lexicon/types/com/atproto/moderation/defs'
|
|
11
|
-
import { forSnapshot } from '../_util'
|
|
12
|
-
import basicSeed from '../seeds/basic'
|
|
13
|
-
|
|
14
|
-
describe('admin get moderation action view', () => {
|
|
15
|
-
let network: TestNetwork
|
|
16
|
-
let agent: AtpAgent
|
|
17
|
-
let sc: SeedClient
|
|
18
|
-
|
|
19
|
-
beforeAll(async () => {
|
|
20
|
-
network = await TestNetwork.create({
|
|
21
|
-
dbPostgresSchema: 'views_admin_get_moderation_action',
|
|
22
|
-
})
|
|
23
|
-
agent = network.pds.getClient()
|
|
24
|
-
sc = network.getSeedClient()
|
|
25
|
-
await basicSeed(sc)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
afterAll(async () => {
|
|
29
|
-
await network.close()
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
beforeAll(async () => {
|
|
33
|
-
const reportRepo = await sc.createReport({
|
|
34
|
-
reportedBy: sc.dids.bob,
|
|
35
|
-
reasonType: REASONSPAM,
|
|
36
|
-
subject: {
|
|
37
|
-
$type: 'com.atproto.admin.defs#repoRef',
|
|
38
|
-
did: sc.dids.alice,
|
|
39
|
-
},
|
|
40
|
-
})
|
|
41
|
-
const reportRecord = await sc.createReport({
|
|
42
|
-
reportedBy: sc.dids.carol,
|
|
43
|
-
reasonType: REASONOTHER,
|
|
44
|
-
reason: 'defamation',
|
|
45
|
-
subject: {
|
|
46
|
-
$type: 'com.atproto.repo.strongRef',
|
|
47
|
-
uri: sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
48
|
-
cid: sc.posts[sc.dids.alice][0].ref.cidStr,
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
const flagRepo = await sc.takeModerationAction({
|
|
52
|
-
action: FLAG,
|
|
53
|
-
subject: {
|
|
54
|
-
$type: 'com.atproto.admin.defs#repoRef',
|
|
55
|
-
did: sc.dids.alice,
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
const takedownRecord = await sc.takeModerationAction({
|
|
59
|
-
action: TAKEDOWN,
|
|
60
|
-
subject: {
|
|
61
|
-
$type: 'com.atproto.repo.strongRef',
|
|
62
|
-
uri: sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
63
|
-
cid: sc.posts[sc.dids.alice][0].ref.cidStr,
|
|
64
|
-
},
|
|
65
|
-
})
|
|
66
|
-
await sc.resolveReports({
|
|
67
|
-
actionId: flagRepo.id,
|
|
68
|
-
reportIds: [reportRepo.id, reportRecord.id],
|
|
69
|
-
})
|
|
70
|
-
await sc.resolveReports({
|
|
71
|
-
actionId: takedownRecord.id,
|
|
72
|
-
reportIds: [reportRecord.id],
|
|
73
|
-
})
|
|
74
|
-
await sc.reverseModerationAction({ id: flagRepo.id })
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
it('gets moderation action for a repo.', async () => {
|
|
78
|
-
const result = await agent.api.com.atproto.admin.getModerationAction(
|
|
79
|
-
{ id: 1 },
|
|
80
|
-
{ headers: { authorization: network.pds.adminAuth() } },
|
|
81
|
-
)
|
|
82
|
-
expect(forSnapshot(result.data)).toMatchSnapshot()
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it('gets moderation action for a record.', async () => {
|
|
86
|
-
const result = await agent.api.com.atproto.admin.getModerationAction(
|
|
87
|
-
{ id: 2 },
|
|
88
|
-
{ headers: { authorization: network.pds.adminAuth() } },
|
|
89
|
-
)
|
|
90
|
-
expect(forSnapshot(result.data)).toMatchSnapshot()
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('fails when moderation action does not exist.', async () => {
|
|
94
|
-
const promise = agent.api.com.atproto.admin.getModerationAction(
|
|
95
|
-
{ id: 100 },
|
|
96
|
-
{ headers: { authorization: network.pds.adminAuth() } },
|
|
97
|
-
)
|
|
98
|
-
await expect(promise).rejects.toThrow('Action not found')
|
|
99
|
-
})
|
|
100
|
-
})
|