Skip to content

Commit

Permalink
✨ Adjust resolving appeal with refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
foysalit committed Nov 16, 2024
1 parent 5822841 commit 43b2356
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions automod/engine/persist.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ func (eng *Engine) persistRecordModActions(c *RecordContext) error {
atURI := c.RecordOp.ATURI().String()
newLabels := dedupeStrings(c.effects.RecordLabels)
newTags := dedupeStrings(c.effects.RecordTags)
if (len(newLabels) > 0 || len(newTags) > 0) && eng.OzoneClient != nil {
resolveAppeal := c.effects.RecordAppealResolve
if (len(newLabels) > 0 || len(newTags) > 0 || resolveAppeal) && eng.OzoneClient != nil {
// fetch existing record labels, tags, etc
rv, err := toolsozone.ModerationGetRecord(ctx, eng.OzoneClient, c.RecordOp.CID.String(), c.RecordOp.ATURI().String())
if err != nil {
Expand All @@ -296,6 +297,7 @@ func (eng *Engine) persistRecordModActions(c *RecordContext) error {
existingTags = rv.Moderation.SubjectStatus.Tags
}
newTags = dedupeTagActions(newTags, existingTags)
resolveAppeal = resolveAppeal && *rv.Moderation.SubjectStatus.Appealed
}
}

Expand Down Expand Up @@ -323,7 +325,7 @@ func (eng *Engine) persistRecordModActions(c *RecordContext) error {
return fmt.Errorf("failed to circuit break takedowns: %w", err)
}

resolveAppeal, err := eng.circuitBreakModAction(ctx, c.effects.RecordAppealResolve)
resolveAppeal, err = eng.circuitBreakModAction(ctx, resolveAppeal)
if err != nil {
return fmt.Errorf("failed to circuit break resolve appeal: %w", err)
}
Expand Down Expand Up @@ -444,6 +446,7 @@ func (eng *Engine) persistRecordModActions(c *RecordContext) error {
if err != nil {
c.Logger.Error("failed to execute record takedown", "err", err)
}
resolveAppeal = false
}

if resolveAppeal {
Expand Down

0 comments on commit 43b2356

Please sign in to comment.