this repo has no description
0
fork

Configure Feed

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

more automod account metadata (#789)

authored by

bnewbold and committed by
GitHub
f336c8ec 25c72f51

+26 -4
+9 -2
automod/engine/account_meta.go
··· 38 38 DisplayName *string 39 39 } 40 40 41 + // opaque fingerprints for correlating abusive accounts 42 + type AbuseSignature struct { 43 + Property string 44 + Value string 45 + } 46 + 41 47 type AccountPrivate struct { 42 48 Email string 43 49 EmailConfirmed bool 44 50 IndexedAt *time.Time 45 51 AccountTags []string 46 52 // ReviewState will be one of ReviewStateEscalated, ReviewStateOpen, ReviewStateClosed, ReviewStateNone, or "" (unknown) 47 - ReviewState string 48 - Appealed bool 53 + ReviewState string 54 + Appealed bool 55 + AbuseSignatures []AbuseSignature 49 56 }
+4
automod/engine/engine.go
··· 351 351 c.Logger.Info("canonical-event-line", 352 352 "accountLabels", c.effects.AccountLabels, 353 353 "accountFlags", c.effects.AccountFlags, 354 + "accountTags", c.effects.AccountTags, 354 355 "accountTakedown", c.effects.AccountTakedown, 355 356 "accountReports", len(c.effects.AccountReports), 356 357 ) ··· 360 361 c.Logger.Info("canonical-event-line", 361 362 "accountLabels", c.effects.AccountLabels, 362 363 "accountFlags", c.effects.AccountFlags, 364 + "accountTags", c.effects.AccountTags, 363 365 "accountTakedown", c.effects.AccountTakedown, 364 366 "accountReports", len(c.effects.AccountReports), 365 367 "recordLabels", c.effects.RecordLabels, 366 368 "recordFlags", c.effects.RecordFlags, 369 + "recordTags", c.effects.RecordTags, 367 370 "recordTakedown", c.effects.RecordTakedown, 368 371 "recordReports", len(c.effects.RecordReports), 369 372 ) ··· 373 376 c.Logger.Info("canonical-event-line", 374 377 "accountLabels", c.effects.AccountLabels, 375 378 "accountFlags", c.effects.AccountFlags, 379 + "accountTags", c.effects.AccountTags, 376 380 "accountTakedown", c.effects.AccountTakedown, 377 381 "accountReports", len(c.effects.AccountReports), 378 382 "reject", c.effects.RejectEvent,
+7
automod/engine/fetch_account_meta.go
··· 150 150 } 151 151 } 152 152 } 153 + if rd.ThreatSignatures != nil || len(rd.ThreatSignatures) > 0 { 154 + asigs := make([]AbuseSignature, len(rd.ThreatSignatures)) 155 + for i, sig := range rd.ThreatSignatures { 156 + asigs[i] = AbuseSignature{Property: sig.Property, Value: sig.Value} 157 + } 158 + ap.AbuseSignatures = asigs 159 + } 153 160 am.Private = &ap 154 161 } 155 162 }
+6 -2
automod/engine/persist.go
··· 285 285 existingLabels = dedupeStrings(existingLabels) 286 286 negLabels = dedupeStrings(negLabels) 287 287 newLabels = dedupeLabelActions(newLabels, existingLabels, negLabels) 288 - newTags = dedupeTagActions(newTags, rv.Moderation.SubjectStatus.Tags) 288 + existingTags := []string{} 289 + if rv.Moderation != nil && rv.Moderation.SubjectStatus != nil && rv.Moderation.SubjectStatus.Tags != nil { 290 + existingTags = rv.Moderation.SubjectStatus.Tags 291 + } 292 + newTags = dedupeTagActions(newTags, existingTags) 289 293 } 290 294 } 291 295 ··· 389 393 CreatedBy: xrpcc.Auth.Did, 390 394 Event: &toolsozone.ModerationEmitEvent_Input_Event{ 391 395 ModerationDefs_ModEventTag: &toolsozone.ModerationDefs_ModEventTag{ 392 - Add: newLabels, 396 + Add: newTags, 393 397 Remove: []string{}, 394 398 Comment: &comment, 395 399 },