Skip to content

Commit

Permalink
automod: additional logging when taking actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Dec 7, 2023
1 parent 7f1bf84 commit cfa5257
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions automod/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func (e *RepoEvent) PersistAccountActions(ctx context.Context) error {
needsPurge := false
xrpcc := e.Engine.AdminClient
if len(newLabels) > 0 {
e.Logger.Info("labeling record", "newLabels", newLabels)
comment := "automod"
_, err := comatproto.AdminEmitModerationEvent(ctx, xrpcc, &comatproto.AdminEmitModerationEvent_Input{
CreatedBy: xrpcc.Auth.Did,
Expand Down Expand Up @@ -286,6 +287,7 @@ func (e *RepoEvent) PersistAccountActions(ctx context.Context) error {
}
}
if newTakedown {
e.Logger.Warn("account-takedown")
comment := "automod"
_, err := comatproto.AdminEmitModerationEvent(ctx, xrpcc, &comatproto.AdminEmitModerationEvent_Input{
CreatedBy: xrpcc.Auth.Did,
Expand Down Expand Up @@ -435,6 +437,7 @@ func (e *RecordEvent) PersistRecordActions(ctx context.Context) error {
}
xrpcc := e.Engine.AdminClient
if len(newLabels) > 0 {
e.Logger.Info("labeling record", "newLabels", newLabels)
comment := "automod"
_, err := comatproto.AdminEmitModerationEvent(ctx, xrpcc, &comatproto.AdminEmitModerationEvent_Input{
CreatedBy: xrpcc.Auth.Did,
Expand All @@ -457,6 +460,7 @@ func (e *RecordEvent) PersistRecordActions(ctx context.Context) error {
e.Engine.Flags.Add(ctx, atURI, newFlags)
}
for _, mr := range newReports {
e.Logger.Info("reporting record", "reasonType", mr.ReasonType, "comment", mr.Comment)
_, err := comatproto.ModerationCreateReport(ctx, xrpcc, &comatproto.ModerationCreateReport_Input{
ReasonType: &mr.ReasonType,
Reason: &mr.Comment,
Expand All @@ -469,6 +473,7 @@ func (e *RecordEvent) PersistRecordActions(ctx context.Context) error {
}
}
if newTakedown {
e.Logger.Warn("record-takedown")
comment := "automod"
_, err := comatproto.AdminEmitModerationEvent(ctx, xrpcc, &comatproto.AdminEmitModerationEvent_Input{
CreatedBy: xrpcc.Auth.Did,
Expand Down

0 comments on commit cfa5257

Please sign in to comment.