@atproto/ozone 0.1.45 → 0.1.47
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 +25 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +4 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/moderation/getRecord.d.ts.map +1 -1
- package/dist/api/moderation/getRecord.js +5 -4
- package/dist/api/moderation/getRecord.js.map +1 -1
- package/dist/api/moderation/getRecords.d.ts +4 -0
- package/dist/api/moderation/getRecords.d.ts.map +1 -0
- package/dist/api/moderation/getRecords.js +37 -0
- package/dist/api/moderation/getRecords.js.map +1 -0
- package/dist/api/moderation/getRepo.d.ts.map +1 -1
- package/dist/api/moderation/getRepo.js +5 -4
- package/dist/api/moderation/getRepo.js.map +1 -1
- package/dist/api/moderation/getRepos.d.ts +4 -0
- package/dist/api/moderation/getRepos.d.ts.map +1 -0
- package/dist/api/moderation/getRepos.js +36 -0
- package/dist/api/moderation/getRepos.js.map +1 -0
- package/dist/api/util.d.ts +1 -1
- package/dist/api/util.d.ts.map +1 -1
- package/dist/api/util.js +13 -9
- package/dist/api/util.js.map +1 -1
- package/dist/db/migrations/20241001T205730722Z-subject-status-review-state-index.d.ts +4 -0
- package/dist/db/migrations/20241001T205730722Z-subject-status-review-state-index.d.ts.map +1 -0
- package/dist/db/migrations/20241001T205730722Z-subject-status-review-state-index.js +18 -0
- package/dist/db/migrations/20241001T205730722Z-subject-status-review-state-index.js.map +1 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +2 -1
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/lexicon/index.d.ts +4 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +8 -0
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +118 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +135 -3
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/profile.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/actor/profile.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/profile.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts +13 -2
- package/dist/lexicon/types/app/bsky/feed/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/defs.js +21 -1
- package/dist/lexicon/types/app/bsky/feed/defs.js.map +1 -1
- package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts +1 -0
- package/dist/lexicon/types/app/bsky/feed/getAuthorFeed.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts +2 -0
- package/dist/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.d.ts.map +1 -1
- package/dist/lexicon/types/com/atproto/repo/getRecord.d.ts +1 -0
- package/dist/lexicon/types/com/atproto/repo/getRecord.d.ts.map +1 -1
- package/dist/lexicon/types/tools/ozone/moderation/getRecords.d.ts +39 -0
- package/dist/lexicon/types/tools/ozone/moderation/getRecords.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/moderation/getRecords.js +3 -0
- package/dist/lexicon/types/tools/ozone/moderation/getRecords.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/moderation/getRepos.d.ts +39 -0
- package/dist/lexicon/types/tools/ozone/moderation/getRepos.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/moderation/getRepos.js +3 -0
- package/dist/lexicon/types/tools/ozone/moderation/getRepos.js.map +1 -0
- package/dist/mod-service/views.d.ts +5 -5
- package/dist/mod-service/views.d.ts.map +1 -1
- package/dist/mod-service/views.js +75 -48
- package/dist/mod-service/views.js.map +1 -1
- package/package.json +9 -9
- package/src/api/index.ts +4 -0
- package/src/api/moderation/getRecord.ts +7 -5
- package/src/api/moderation/getRecords.ts +50 -0
- package/src/api/moderation/getRepo.ts +7 -5
- package/src/api/moderation/getRepos.ts +41 -0
- package/src/api/util.ts +16 -9
- package/src/db/migrations/20241001T205730722Z-subject-status-review-state-index.ts +15 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/lexicon/index.ts +24 -0
- package/src/lexicon/lexicons.ts +137 -3
- package/src/lexicon/types/app/bsky/actor/defs.ts +2 -0
- package/src/lexicon/types/app/bsky/actor/profile.ts +1 -0
- package/src/lexicon/types/app/bsky/feed/defs.ts +38 -2
- package/src/lexicon/types/app/bsky/feed/getAuthorFeed.ts +1 -0
- package/src/lexicon/types/app/bsky/graph/getSuggestedFollowsByActor.ts +2 -0
- package/src/lexicon/types/app/bsky/unspecced/getSuggestionsSkeleton.ts +2 -0
- package/src/lexicon/types/com/atproto/repo/getRecord.ts +1 -0
- package/src/lexicon/types/tools/ozone/moderation/getRecords.ts +50 -0
- package/src/lexicon/types/tools/ozone/moderation/getRepos.ts +50 -0
- package/src/mod-service/views.ts +93 -52
- package/tests/__snapshots__/get-records.test.ts.snap +153 -0
- package/tests/__snapshots__/get-repos.test.ts.snap +108 -0
- package/tests/get-records.test.ts +87 -0
- package/tests/get-repos.test.ts +87 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`admin get records view get multiple records by uris 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"records": Array [
|
|
6
|
+
Object {
|
|
7
|
+
"$type": "tools.ozone.moderation.defs#recordViewDetail",
|
|
8
|
+
"blobCids": Array [],
|
|
9
|
+
"blobs": Array [],
|
|
10
|
+
"cid": "cids(0)",
|
|
11
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
12
|
+
"labels": Array [
|
|
13
|
+
Object {
|
|
14
|
+
"cid": "cids(0)",
|
|
15
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
16
|
+
"sig": Object {
|
|
17
|
+
"$bytes": "sig(0)",
|
|
18
|
+
},
|
|
19
|
+
"src": "user(2)",
|
|
20
|
+
"uri": "record(0)",
|
|
21
|
+
"val": "!takedown",
|
|
22
|
+
"ver": 1,
|
|
23
|
+
},
|
|
24
|
+
Object {
|
|
25
|
+
"cid": "cids(0)",
|
|
26
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
27
|
+
"src": "user(0)",
|
|
28
|
+
"uri": "record(0)",
|
|
29
|
+
"val": "self-label",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
"moderation": Object {
|
|
33
|
+
"subjectStatus": Object {
|
|
34
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
35
|
+
"id": 1,
|
|
36
|
+
"lastReportedAt": "1970-01-01T00:00:00.000Z",
|
|
37
|
+
"lastReviewedAt": "1970-01-01T00:00:00.000Z",
|
|
38
|
+
"lastReviewedBy": "user(1)",
|
|
39
|
+
"reviewState": "tools.ozone.moderation.defs#reviewClosed",
|
|
40
|
+
"subject": Object {
|
|
41
|
+
"$type": "com.atproto.repo.strongRef",
|
|
42
|
+
"cid": "cids(0)",
|
|
43
|
+
"uri": "record(0)",
|
|
44
|
+
},
|
|
45
|
+
"subjectBlobCids": Array [],
|
|
46
|
+
"subjectRepoHandle": "alice.test",
|
|
47
|
+
"tags": Array [
|
|
48
|
+
"lang:en",
|
|
49
|
+
],
|
|
50
|
+
"takendown": true,
|
|
51
|
+
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
"repo": Object {
|
|
55
|
+
"did": "user(0)",
|
|
56
|
+
"email": "alice@test.com",
|
|
57
|
+
"handle": "alice.test",
|
|
58
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
59
|
+
"invitesDisabled": false,
|
|
60
|
+
"moderation": Object {},
|
|
61
|
+
"relatedRecords": Array [
|
|
62
|
+
Object {
|
|
63
|
+
"$type": "app.bsky.actor.profile",
|
|
64
|
+
"avatar": Object {
|
|
65
|
+
"$type": "blob",
|
|
66
|
+
"mimeType": "image/jpeg",
|
|
67
|
+
"ref": Object {
|
|
68
|
+
"$link": "cids(1)",
|
|
69
|
+
},
|
|
70
|
+
"size": 3976,
|
|
71
|
+
},
|
|
72
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
73
|
+
"description": "its me!",
|
|
74
|
+
"displayName": "ali",
|
|
75
|
+
"labels": Object {
|
|
76
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
77
|
+
"values": Array [
|
|
78
|
+
Object {
|
|
79
|
+
"val": "self-label-a",
|
|
80
|
+
},
|
|
81
|
+
Object {
|
|
82
|
+
"val": "self-label-b",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
"uri": "record(0)",
|
|
90
|
+
"value": Object {
|
|
91
|
+
"$type": "app.bsky.feed.post",
|
|
92
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
93
|
+
"labels": Object {
|
|
94
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
95
|
+
"values": Array [
|
|
96
|
+
Object {
|
|
97
|
+
"val": "self-label",
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
"text": "hey there",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
Object {
|
|
105
|
+
"$type": "tools.ozone.moderation.defs#recordViewDetail",
|
|
106
|
+
"blobCids": Array [],
|
|
107
|
+
"blobs": Array [],
|
|
108
|
+
"cid": "cids(2)",
|
|
109
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
110
|
+
"labels": Array [],
|
|
111
|
+
"moderation": Object {},
|
|
112
|
+
"repo": Object {
|
|
113
|
+
"did": "user(3)",
|
|
114
|
+
"email": "bob@test.com",
|
|
115
|
+
"handle": "bob.test",
|
|
116
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
117
|
+
"invitesDisabled": false,
|
|
118
|
+
"moderation": Object {},
|
|
119
|
+
"relatedRecords": Array [
|
|
120
|
+
Object {
|
|
121
|
+
"$type": "app.bsky.actor.profile",
|
|
122
|
+
"avatar": Object {
|
|
123
|
+
"$type": "blob",
|
|
124
|
+
"mimeType": "image/jpeg",
|
|
125
|
+
"ref": Object {
|
|
126
|
+
"$link": "cids(1)",
|
|
127
|
+
},
|
|
128
|
+
"size": 3976,
|
|
129
|
+
},
|
|
130
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
131
|
+
"description": "hi im bob label_me",
|
|
132
|
+
"displayName": "bobby",
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
"uri": "record(1)",
|
|
137
|
+
"value": Object {
|
|
138
|
+
"$type": "app.bsky.feed.post",
|
|
139
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
140
|
+
"langs": Array [
|
|
141
|
+
"en-US",
|
|
142
|
+
"i-klingon",
|
|
143
|
+
],
|
|
144
|
+
"text": "bob back at it again!",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
Object {
|
|
148
|
+
"$type": "tools.ozone.moderation.defs#recordViewNotFound",
|
|
149
|
+
"uri": "record(2)",
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`admin get multiple repos gets multiple repos by did 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"repos": Array [
|
|
6
|
+
Object {
|
|
7
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
8
|
+
"did": "user(0)",
|
|
9
|
+
"email": "alice@test.com",
|
|
10
|
+
"handle": "alice.test",
|
|
11
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
12
|
+
"invites": Array [],
|
|
13
|
+
"invitesDisabled": false,
|
|
14
|
+
"labels": Array [
|
|
15
|
+
Object {
|
|
16
|
+
"cts": "1970-01-01T00:00:00.000Z",
|
|
17
|
+
"sig": Object {
|
|
18
|
+
"$bytes": "sig(0)",
|
|
19
|
+
},
|
|
20
|
+
"src": "user(2)",
|
|
21
|
+
"uri": "user(0)",
|
|
22
|
+
"val": "!takedown",
|
|
23
|
+
"ver": 1,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
"moderation": Object {
|
|
27
|
+
"subjectStatus": Object {
|
|
28
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
29
|
+
"id": 1,
|
|
30
|
+
"lastReportedAt": "1970-01-01T00:00:00.000Z",
|
|
31
|
+
"lastReviewedAt": "1970-01-01T00:00:00.000Z",
|
|
32
|
+
"lastReviewedBy": "user(1)",
|
|
33
|
+
"reviewState": "tools.ozone.moderation.defs#reviewClosed",
|
|
34
|
+
"subject": Object {
|
|
35
|
+
"$type": "com.atproto.admin.defs#repoRef",
|
|
36
|
+
"did": "user(0)",
|
|
37
|
+
},
|
|
38
|
+
"subjectBlobCids": Array [],
|
|
39
|
+
"subjectRepoHandle": "alice.test",
|
|
40
|
+
"tags": Array [
|
|
41
|
+
"lang:und",
|
|
42
|
+
],
|
|
43
|
+
"takendown": true,
|
|
44
|
+
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
"relatedRecords": Array [
|
|
48
|
+
Object {
|
|
49
|
+
"$type": "app.bsky.actor.profile",
|
|
50
|
+
"avatar": Object {
|
|
51
|
+
"$type": "blob",
|
|
52
|
+
"mimeType": "image/jpeg",
|
|
53
|
+
"ref": Object {
|
|
54
|
+
"$link": "cids(0)",
|
|
55
|
+
},
|
|
56
|
+
"size": 3976,
|
|
57
|
+
},
|
|
58
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
59
|
+
"description": "its me!",
|
|
60
|
+
"displayName": "ali",
|
|
61
|
+
"labels": Object {
|
|
62
|
+
"$type": "com.atproto.label.defs#selfLabels",
|
|
63
|
+
"values": Array [
|
|
64
|
+
Object {
|
|
65
|
+
"val": "self-label-a",
|
|
66
|
+
},
|
|
67
|
+
Object {
|
|
68
|
+
"val": "self-label-b",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
Object {
|
|
76
|
+
"$type": "tools.ozone.moderation.defs#repoViewDetail",
|
|
77
|
+
"did": "user(3)",
|
|
78
|
+
"email": "bob@test.com",
|
|
79
|
+
"handle": "bob.test",
|
|
80
|
+
"indexedAt": "1970-01-01T00:00:00.000Z",
|
|
81
|
+
"invites": Array [],
|
|
82
|
+
"invitesDisabled": false,
|
|
83
|
+
"labels": Array [],
|
|
84
|
+
"moderation": Object {},
|
|
85
|
+
"relatedRecords": Array [
|
|
86
|
+
Object {
|
|
87
|
+
"$type": "app.bsky.actor.profile",
|
|
88
|
+
"avatar": Object {
|
|
89
|
+
"$type": "blob",
|
|
90
|
+
"mimeType": "image/jpeg",
|
|
91
|
+
"ref": Object {
|
|
92
|
+
"$link": "cids(0)",
|
|
93
|
+
},
|
|
94
|
+
"size": 3976,
|
|
95
|
+
},
|
|
96
|
+
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
97
|
+
"description": "hi im bob label_me",
|
|
98
|
+
"displayName": "bobby",
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
Object {
|
|
103
|
+
"$type": "tools.ozone.moderation.defs#repoViewNotFound",
|
|
104
|
+
"did": "did:web:xyz",
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SeedClient,
|
|
3
|
+
TestNetwork,
|
|
4
|
+
basicSeed,
|
|
5
|
+
TestOzone,
|
|
6
|
+
ModeratorClient,
|
|
7
|
+
} from '@atproto/dev-env'
|
|
8
|
+
import { AtpAgent } from '@atproto/api'
|
|
9
|
+
import {
|
|
10
|
+
REASONOTHER,
|
|
11
|
+
REASONSPAM,
|
|
12
|
+
} from '../src/lexicon/types/com/atproto/moderation/defs'
|
|
13
|
+
import { forSnapshot } from './_util'
|
|
14
|
+
import { ids } from '../src/lexicon/lexicons'
|
|
15
|
+
|
|
16
|
+
describe('admin get records view', () => {
|
|
17
|
+
let network: TestNetwork
|
|
18
|
+
let ozone: TestOzone
|
|
19
|
+
let agent: AtpAgent
|
|
20
|
+
let sc: SeedClient
|
|
21
|
+
let modClient: ModeratorClient
|
|
22
|
+
|
|
23
|
+
beforeAll(async () => {
|
|
24
|
+
network = await TestNetwork.create({
|
|
25
|
+
dbPostgresSchema: 'ozone_admin_get_records',
|
|
26
|
+
})
|
|
27
|
+
ozone = network.ozone
|
|
28
|
+
agent = ozone.getClient()
|
|
29
|
+
sc = network.getSeedClient()
|
|
30
|
+
modClient = ozone.getModClient()
|
|
31
|
+
await basicSeed(sc)
|
|
32
|
+
await network.processAll()
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
afterAll(async () => {
|
|
36
|
+
await network.close()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
beforeAll(async () => {
|
|
40
|
+
await sc.createReport({
|
|
41
|
+
reportedBy: sc.dids.bob,
|
|
42
|
+
reasonType: REASONSPAM,
|
|
43
|
+
subject: {
|
|
44
|
+
$type: 'com.atproto.repo.strongRef',
|
|
45
|
+
uri: sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
46
|
+
cid: sc.posts[sc.dids.alice][0].ref.cidStr,
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
await sc.createReport({
|
|
50
|
+
reportedBy: sc.dids.carol,
|
|
51
|
+
reasonType: REASONOTHER,
|
|
52
|
+
reason: 'defamation',
|
|
53
|
+
subject: {
|
|
54
|
+
$type: 'com.atproto.repo.strongRef',
|
|
55
|
+
uri: sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
56
|
+
cid: sc.posts[sc.dids.alice][0].ref.cidStr,
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
await modClient.emitEvent({
|
|
60
|
+
event: { $type: 'tools.ozone.moderation.defs#modEventTakedown' },
|
|
61
|
+
subject: {
|
|
62
|
+
$type: 'com.atproto.repo.strongRef',
|
|
63
|
+
uri: sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
64
|
+
cid: sc.posts[sc.dids.alice][0].ref.cidStr,
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
await network.bsky.ctx.dataplane.takedownRecord({
|
|
68
|
+
recordUri: sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('get multiple records by uris', async () => {
|
|
73
|
+
const { data } = await agent.tools.ozone.moderation.getRecords(
|
|
74
|
+
{
|
|
75
|
+
uris: [
|
|
76
|
+
sc.posts[sc.dids.alice][0].ref.uriStr,
|
|
77
|
+
sc.posts[sc.dids.bob][0].ref.uriStr,
|
|
78
|
+
// create a uri for a non-existent collection
|
|
79
|
+
sc.posts[sc.dids.bob][0].ref.uriStr.replace('.post', '.test'),
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRecords) },
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
expect(forSnapshot(data)).toMatchSnapshot()
|
|
86
|
+
})
|
|
87
|
+
})
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SeedClient,
|
|
3
|
+
TestNetwork,
|
|
4
|
+
TestOzone,
|
|
5
|
+
basicSeed,
|
|
6
|
+
ModeratorClient,
|
|
7
|
+
} from '@atproto/dev-env'
|
|
8
|
+
import { AtpAgent } from '@atproto/api'
|
|
9
|
+
import {
|
|
10
|
+
REASONOTHER,
|
|
11
|
+
REASONSPAM,
|
|
12
|
+
} from '../src/lexicon/types/com/atproto/moderation/defs'
|
|
13
|
+
import { forSnapshot } from './_util'
|
|
14
|
+
import { ids } from '../src/lexicon/lexicons'
|
|
15
|
+
|
|
16
|
+
describe('admin get multiple repos', () => {
|
|
17
|
+
let network: TestNetwork
|
|
18
|
+
let ozone: TestOzone
|
|
19
|
+
let agent: AtpAgent
|
|
20
|
+
let pdsAgent: AtpAgent
|
|
21
|
+
let sc: SeedClient
|
|
22
|
+
let modClient: ModeratorClient
|
|
23
|
+
|
|
24
|
+
beforeAll(async () => {
|
|
25
|
+
network = await TestNetwork.create({
|
|
26
|
+
dbPostgresSchema: 'ozone_admin_get_repos',
|
|
27
|
+
})
|
|
28
|
+
ozone = network.ozone
|
|
29
|
+
agent = ozone.getClient()
|
|
30
|
+
pdsAgent = network.pds.getClient()
|
|
31
|
+
sc = network.getSeedClient()
|
|
32
|
+
modClient = ozone.getModClient()
|
|
33
|
+
await basicSeed(sc)
|
|
34
|
+
await pdsAgent.com.atproto.server.deactivateAccount(
|
|
35
|
+
{},
|
|
36
|
+
{ encoding: 'application/json', headers: sc.getHeaders(sc.dids.dan) },
|
|
37
|
+
)
|
|
38
|
+
await network.processAll()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
afterAll(async () => {
|
|
42
|
+
await network.close()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
beforeAll(async () => {
|
|
46
|
+
await modClient.emitEvent({
|
|
47
|
+
event: { $type: 'tools.ozone.moderation.defs#modEventAcknowledge' },
|
|
48
|
+
subject: {
|
|
49
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
50
|
+
did: sc.dids.alice,
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
await sc.createReport({
|
|
54
|
+
reportedBy: sc.dids.bob,
|
|
55
|
+
reasonType: REASONSPAM,
|
|
56
|
+
subject: {
|
|
57
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
58
|
+
did: sc.dids.alice,
|
|
59
|
+
},
|
|
60
|
+
})
|
|
61
|
+
await sc.createReport({
|
|
62
|
+
reportedBy: sc.dids.carol,
|
|
63
|
+
reasonType: REASONOTHER,
|
|
64
|
+
reason: 'defamation',
|
|
65
|
+
subject: {
|
|
66
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
67
|
+
did: sc.dids.alice,
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
await modClient.emitEvent({
|
|
71
|
+
event: { $type: 'tools.ozone.moderation.defs#modEventTakedown' },
|
|
72
|
+
subject: {
|
|
73
|
+
$type: 'com.atproto.admin.defs#repoRef',
|
|
74
|
+
did: sc.dids.alice,
|
|
75
|
+
},
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
it('gets multiple repos by did', async () => {
|
|
80
|
+
const { data } = await agent.tools.ozone.moderation.getRepos(
|
|
81
|
+
{ dids: [sc.dids.alice, sc.dids.bob, 'did:web:xyz'] },
|
|
82
|
+
{ headers: await ozone.modHeaders(ids.ToolsOzoneModerationGetRepos) },
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
expect(forSnapshot(data)).toMatchSnapshot()
|
|
86
|
+
})
|
|
87
|
+
})
|