tangled
alpha
login
or
join now
skywatch.blue
/
skywatch-automod
7
fork
atom
A tool for parsing traffic on the jetstream and applying a moderation workstream based on regexp based rules
7
fork
atom
overview
issues
pulls
pipelines
Update language management to be more explicit
D. Scarnecchia
8 months ago
712c4c48
9d252306
+26
-10
3 changed files
expand all
collapse all
unified
split
src
checkPosts.ts
checkProfiles.ts
types.ts
+7
-2
src/checkPosts.ts
reviewed
···
51
51
(postCheck) => postCheck.label === label,
52
52
);
53
53
54
54
-
if (!langs.includes(lang)) {
55
55
-
return;
54
54
+
if (checkPost.language) {
55
55
+
if (!checkPost?.language.includes(lang)) {
56
56
+
logger.info(
57
57
+
`[CHECKPOSTS]: ${checkPost!.label} not supported in ${lang}`,
58
58
+
);
59
59
+
return;
60
60
+
}
56
61
}
57
62
58
63
if (checkPost?.ignoredDIDs) {
+18
-8
src/checkProfiles.ts
reviewed
···
16
16
) => {
17
17
const lang = await getLanguage(description);
18
18
19
19
-
if (!langs.includes(lang)) {
20
20
-
return;
21
21
-
}
22
22
-
23
19
const labels: string[] = Array.from(
24
20
PROFILE_CHECKS,
25
21
(profileCheck) => profileCheck.label,
···
30
26
const checkProfiles = PROFILE_CHECKS.find(
31
27
(profileCheck) => profileCheck.label === label,
32
28
);
29
29
+
30
30
+
if (checkProfiles.language) {
31
31
+
if (!checkProfiles?.language.includes(lang)) {
32
32
+
logger.info(
33
33
+
`[CHECKDESCRIPTION]: ${checkProfiles!.label} not supported for ${lang}`,
34
34
+
);
35
35
+
return;
36
36
+
}
37
37
+
}
33
38
34
39
// Check if DID is whitelisted
35
40
if (checkProfiles?.ignoredDIDs) {
···
94
99
) => {
95
100
const lang = await getLanguage(description);
96
101
97
97
-
if (!langs.includes(lang)) {
98
98
-
return;
99
99
-
}
100
100
-
101
102
// Get a list of labels
102
103
const labels: string[] = Array.from(
103
104
PROFILE_CHECKS,
···
109
110
const checkProfiles = PROFILE_CHECKS.find(
110
111
(profileCheck) => profileCheck.label === label,
111
112
);
113
113
+
114
114
+
if (checkProfiles.language) {
115
115
+
if (!checkProfiles?.language.includes(lang)) {
116
116
+
logger.info(
117
117
+
`[CHECKDESCRIPTION]: ${checkProfiles!.label} not supported for ${lang}`,
118
118
+
);
119
119
+
return;
120
120
+
}
121
121
+
}
112
122
113
123
// Check if DID is whitelisted
114
124
if (checkProfiles?.ignoredDIDs) {
+1
src/types.ts
reviewed
···
1
1
export interface Checks {
2
2
+
language?: string;
2
3
label: string;
3
4
comment: string;
4
5
description?: boolean;