-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Emit record delete events on post/profile with label and appeal
- Loading branch information
Showing
8 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package rules | ||
|
||
import ( | ||
"github.com/bluesky-social/indigo/automod" | ||
) | ||
|
||
var _ automod.OzoneEventRuleFunc = MarkAppealOzoneEventRule | ||
|
||
// looks for appeals on records/accounts and flags subjects | ||
func MarkAppealOzoneEventRule(c *automod.OzoneEventContext) error { | ||
isResolveAppealEvent := c.Event.Event.ModerationDefs_ModEventResolveAppeal != nil | ||
// appeals are just report events emitted by the author of the reported content with a special report type | ||
isAppealEvent := c.Event.Event.ModerationDefs_ModEventReport != nil && *c.Event.Event.ModerationDefs_ModEventReport.ReportType == "com.atproto.moderation.defs#reasonAppeal" | ||
|
||
if !isAppealEvent && !isResolveAppealEvent { | ||
return nil | ||
} | ||
|
||
counterKey := c.Event.SubjectDID.String() | ||
if c.Event.SubjectURI != nil { | ||
counterKey = c.Event.SubjectURI.String() | ||
} | ||
|
||
if isAppealEvent { | ||
c.Increment("appeal", counterKey) | ||
} else { | ||
c.ResetCounter("appeal", counterKey) | ||
} | ||
|
||
return nil | ||
} |