this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

automod: enable reporting on keyword rules (#541)

authored by

bnewbold and committed by
GitHub
16eb1692 12cbabd6

+14 -14
+14 -14
automod/rules/keyword.go
··· 15 15 // used very frequently in a reclaimed context 16 16 if word != "" && word != "faggot" && word != "tranny" { 17 17 c.AddRecordFlag("bad-word-text") 18 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in post text: %s", word)) 18 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in post text or alttext: %s", word)) 19 19 c.Notify("slack") 20 20 break 21 21 } ··· 23 23 tok = strings.TrimSuffix(tok, "s") 24 24 if c.InSet("worst-words", tok) { 25 25 c.AddRecordFlag("bad-word-text") 26 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in post text: %s", word)) 26 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in post text or alttext: %s", word)) 27 27 c.Notify("slack") 28 28 break 29 29 } ··· 38 38 word := keyword.SlugContainsExplicitSlur(keyword.Slugify(*profile.DisplayName)) 39 39 if word != "" { 40 40 c.AddRecordFlag("bad-word-name") 41 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in display name: %s", word)) 41 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in display name: %s", word)) 42 42 c.Notify("slack") 43 43 } 44 44 } ··· 47 47 tok = strings.TrimSuffix(tok, "s") 48 48 if c.InSet("worst-words", tok) { 49 49 c.AddRecordFlag("bad-word-text") 50 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in profile description: %s", word)) 50 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in profile description: %s", tok)) 51 51 c.Notify("slack") 52 52 break 53 53 } ··· 108 108 word := keyword.SlugContainsExplicitSlur(keyword.Slugify(name)) 109 109 if word != "" { 110 110 c.AddRecordFlag("bad-word-name") 111 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in name: %s", tok)) 111 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in name: %s", word)) 112 112 c.Notify("slack") 113 113 } 114 114 tokens := keyword.TokenizeText(name) 115 115 for _, tok := range tokens { 116 116 if c.InSet("bad-words", tok) { 117 117 c.AddRecordFlag("bad-word-name") 118 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in name: %s", tok)) 118 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in name: %s", tok)) 119 119 c.Notify("slack") 120 120 break 121 121 } ··· 126 126 word := keyword.SlugContainsExplicitSlur(keyword.Slugify(text)) 127 127 if word != "" { 128 128 c.AddRecordFlag("bad-word-text") 129 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in description: %s", word)) 129 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in description: %s", word)) 130 130 c.Notify("slack") 131 131 } 132 132 tokens := keyword.TokenizeText(text) ··· 135 135 tok = strings.TrimSuffix(tok, "s") 136 136 if c.InSet("worst-words", tok) { 137 137 c.AddRecordFlag("bad-word-text") 138 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in description: %s", tok)) 138 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in description: %s", tok)) 139 139 c.Notify("slack") 140 140 break 141 141 } ··· 152 152 word := keyword.SlugIsExplicitSlur(keyword.Slugify(c.RecordOp.RecordKey.String())) 153 153 if word != "" { 154 154 c.AddRecordFlag("bad-word-recordkey") 155 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in record-key (URL): %s", word)) 155 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in record-key (URL): %s", word)) 156 156 c.Notify("slack") 157 157 } 158 158 tokens := keyword.TokenizeIdentifier(c.RecordOp.RecordKey.String()) 159 159 for _, tok := range tokens { 160 160 if c.InSet("bad-words", tok) { 161 161 c.AddRecordFlag("bad-word-recordkey") 162 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in record-key (URL): %s", tok)) 162 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in record-key (URL): %s", tok)) 163 163 c.Notify("slack") 164 164 break 165 165 } ··· 174 174 word := keyword.SlugContainsExplicitSlur(keyword.Slugify(c.Account.Identity.Handle.String())) 175 175 if word != "" { 176 176 c.AddAccountFlag("bad-word-handle") 177 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in handle (username): %s", word)) 177 + c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible bad word in handle (username): %s", word)) 178 178 c.Notify("slack") 179 179 return nil 180 180 } ··· 183 183 for _, tok := range tokens { 184 184 if c.InSet("bad-words", tok) { 185 185 c.AddAccountFlag("bad-word-handle") 186 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in handle (username): %s", tok)) 186 + c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible bad word in handle (username): %s", tok)) 187 187 c.Notify("slack") 188 188 break 189 189 } ··· 201 201 word := keyword.SlugContainsExplicitSlur(keyword.Slugify(c.Account.Identity.DID.String())) 202 202 if word != "" { 203 203 c.AddAccountFlag("bad-word-did") 204 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in DID (account identifier): %s", word)) 204 + c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible bad word in DID (account identifier): %s", word)) 205 205 c.Notify("slack") 206 206 return nil 207 207 } ··· 210 210 for _, tok := range tokens { 211 211 if c.InSet("bad-words", tok) { 212 212 c.AddAccountFlag("bad-word-did") 213 - // TODO: c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad word in DID (account identifier): %s", tok)) 213 + c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible bad word in DID (account identifier): %s", tok)) 214 214 c.Notify("slack") 215 215 break 216 216 }