@atproto/ozone 0.1.9 → 0.1.10
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 +7 -0
- package/dist/lexicon/lexicons.d.ts +32 -0
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +33 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts +16 -1
- package/dist/lexicon/types/app/bsky/actor/defs.d.ts.map +1 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js +21 -1
- package/dist/lexicon/types/app/bsky/actor/defs.js.map +1 -1
- package/dist/mod-service/lang-data.d.ts +12 -0
- package/dist/mod-service/lang-data.d.ts.map +1 -0
- package/dist/mod-service/lang-data.js +555 -0
- package/dist/mod-service/lang-data.js.map +1 -0
- package/dist/mod-service/lang.d.ts +1 -0
- package/dist/mod-service/lang.d.ts.map +1 -1
- package/dist/mod-service/lang.js +50 -0
- package/dist/mod-service/lang.js.map +1 -1
- package/jest.config.js +1 -1
- package/package.json +4 -3
- package/src/lexicon/lexicons.ts +33 -0
- package/src/lexicon/types/app/bsky/actor/defs.ts +38 -0
- package/src/mod-service/lang-data.ts +561 -0
- package/src/mod-service/lang.ts +34 -0
- package/tests/__snapshots__/get-record.test.ts.snap +2 -2
- package/tests/__snapshots__/moderation-events.test.ts.snap +1 -1
- package/tests/__snapshots__/moderation-statuses.test.ts.snap +1 -1
- package/tests/lang.test.ts +109 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ModeratorClient,
|
|
3
|
+
SeedClient,
|
|
4
|
+
TestNetwork,
|
|
5
|
+
basicSeed,
|
|
6
|
+
} from '@atproto/dev-env'
|
|
7
|
+
import AtpAgent from '@atproto/api'
|
|
8
|
+
import { REASONSPAM } from '../src/lexicon/types/com/atproto/moderation/defs'
|
|
9
|
+
|
|
10
|
+
describe('moderation status language tagging', () => {
|
|
11
|
+
let network: TestNetwork
|
|
12
|
+
let agent: AtpAgent
|
|
13
|
+
let sc: SeedClient
|
|
14
|
+
let modClient: ModeratorClient
|
|
15
|
+
|
|
16
|
+
beforeAll(async () => {
|
|
17
|
+
network = await TestNetwork.create({
|
|
18
|
+
dbPostgresSchema: 'ozone_blob_divert_test',
|
|
19
|
+
ozone: {
|
|
20
|
+
blobDivertUrl: `https://blob-report.com`,
|
|
21
|
+
blobDivertAdminPassword: 'test-auth-token',
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
agent = network.pds.getClient()
|
|
25
|
+
sc = network.getSeedClient()
|
|
26
|
+
modClient = network.ozone.getModClient()
|
|
27
|
+
await basicSeed(sc)
|
|
28
|
+
await network.processAll()
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
afterAll(async () => {
|
|
32
|
+
await network.close()
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const getStatus = async (subject: string) => {
|
|
36
|
+
const { subjectStatuses } = await modClient.queryStatuses({
|
|
37
|
+
subject,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
return subjectStatuses[0]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
it('Adds language tag to post from text', async () => {
|
|
44
|
+
const createPostAndReport = async (text: string) => {
|
|
45
|
+
const post = await sc.post(sc.dids.carol, text)
|
|
46
|
+
await network.processAll()
|
|
47
|
+
const report = await sc.createReport({
|
|
48
|
+
reasonType: REASONSPAM,
|
|
49
|
+
subject: {
|
|
50
|
+
$type: 'com.atproto.repo.strongRef',
|
|
51
|
+
uri: post.ref.uriStr,
|
|
52
|
+
cid: post.ref.cidStr,
|
|
53
|
+
},
|
|
54
|
+
reportedBy: sc.dids.alice,
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
return { post, report }
|
|
58
|
+
}
|
|
59
|
+
const [japanesePost, greekPost] = await Promise.all([
|
|
60
|
+
createPostAndReport('Xで有名な人達+反AIや絵描きによくない'),
|
|
61
|
+
createPostAndReport(
|
|
62
|
+
'Λορεμ ιπσθμ δολορ σιτ αμετ, μει θτ vιδιτ νοστρθμ προπριαε',
|
|
63
|
+
),
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
const [japanesePostStatus, greekPostStatus] = await Promise.all([
|
|
67
|
+
getStatus(japanesePost.post.ref.uriStr),
|
|
68
|
+
getStatus(greekPost.post.ref.uriStr),
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
expect(japanesePostStatus.tags).toContain('lang:ja')
|
|
72
|
+
expect(greekPostStatus.tags).toContain('lang:el')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('Uses name/description text for language tag for list', async () => {
|
|
76
|
+
const createListAndReport = async (name: string, description?: string) => {
|
|
77
|
+
const list = await sc.createList(sc.dids.carol, name, 'mod', {
|
|
78
|
+
description,
|
|
79
|
+
})
|
|
80
|
+
await network.processAll()
|
|
81
|
+
const report = await sc.createReport({
|
|
82
|
+
reasonType: REASONSPAM,
|
|
83
|
+
subject: {
|
|
84
|
+
$type: 'com.atproto.repo.strongRef',
|
|
85
|
+
uri: list.uriStr,
|
|
86
|
+
cid: list.cidStr,
|
|
87
|
+
},
|
|
88
|
+
reportedBy: sc.dids.alice,
|
|
89
|
+
})
|
|
90
|
+
return { list, report }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const [listWithDescription, listWithoutDescription] = await Promise.all([
|
|
94
|
+
createListAndReport(
|
|
95
|
+
'よくない',
|
|
96
|
+
'Xで有名な人達+反AIや絵描きによくない感情を持つ人達+絵描き詐称',
|
|
97
|
+
),
|
|
98
|
+
createListAndReport('人達+反AIや絵描きによくない感情'),
|
|
99
|
+
])
|
|
100
|
+
|
|
101
|
+
const [japaneseListStatus, chineseListStatus] = await Promise.all([
|
|
102
|
+
getStatus(listWithDescription.list.uriStr),
|
|
103
|
+
getStatus(listWithoutDescription.list.uriStr),
|
|
104
|
+
])
|
|
105
|
+
|
|
106
|
+
expect(japaneseListStatus.tags).toContain('lang:ja')
|
|
107
|
+
expect(chineseListStatus.tags).toContain('lang:ja')
|
|
108
|
+
})
|
|
109
|
+
})
|