A tool for parsing traffic on the jetstream and applying a moderation workstream based on regexp based rules

Update language management to be more explicit

+26 -10
+7 -2
src/checkPosts.ts
··· 51 51 (postCheck) => postCheck.label === label, 52 52 ); 53 53 54 - if (!langs.includes(lang)) { 55 - return; 54 + if (checkPost.language) { 55 + if (!checkPost?.language.includes(lang)) { 56 + logger.info( 57 + `[CHECKPOSTS]: ${checkPost!.label} not supported in ${lang}`, 58 + ); 59 + return; 60 + } 56 61 } 57 62 58 63 if (checkPost?.ignoredDIDs) {
+18 -8
src/checkProfiles.ts
··· 16 16 ) => { 17 17 const lang = await getLanguage(description); 18 18 19 - if (!langs.includes(lang)) { 20 - return; 21 - } 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 + 30 + if (checkProfiles.language) { 31 + if (!checkProfiles?.language.includes(lang)) { 32 + logger.info( 33 + `[CHECKDESCRIPTION]: ${checkProfiles!.label} not supported for ${lang}`, 34 + ); 35 + return; 36 + } 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 - if (!langs.includes(lang)) { 98 - return; 99 - } 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 + 114 + if (checkProfiles.language) { 115 + if (!checkProfiles?.language.includes(lang)) { 116 + logger.info( 117 + `[CHECKDESCRIPTION]: ${checkProfiles!.label} not supported for ${lang}`, 118 + ); 119 + return; 120 + } 121 + } 112 122 113 123 // Check if DID is whitelisted 114 124 if (checkProfiles?.ignoredDIDs) {
+1
src/types.ts
··· 1 1 export interface Checks { 2 + language?: string; 2 3 label: string; 3 4 comment: string; 4 5 description?: boolean;