Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add a policy property to takedown events #3271

Merged
merged 5 commits into from
Jan 3, 2025

Conversation

foysalit
Copy link
Contributor

@foysalit foysalit commented Dec 19, 2024

This PR adds an optional policy property to all takedown events that allows an arbitrary string value and allows moderators to query for all takedowns by specifying a policy param through th queryEvents endpoint.

Comment on lines 228 to 231
"policy": {
"type": "string",
"description": "Name/Keyword of the policy that drove the decision."
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any merit to sprinkling this onto other event types such as modEventLabel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Labels themselves are quite descriptive of the "why" part of the action and confirmed from T&S folks that this won't be necessary any time soon.

Comment on lines 109 to 112
"policy": {
"type": "string",
"description": "If specified, only events where the policy matches the given policy are returned"
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a decent chance we end-up wanting to list multiple policies here in the future? If so, we could proactively make this an array.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T&S expressed that this may be nice to have at some point but not anytime soon. I'll get it in the backend but the UI side will mostly keep it 1:1

Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple small comments, looking good! Also may want to add a changeset for @atproto/api and @atproto/ozone before merging.

) {
eventView.event = {
...eventView.event,
policy: event.meta.policy,
policies: event.meta.policies.split(' '),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look out for the empty string, which likes to split into [''].

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other words:

const policies = []
const serialized = policies.join(' ')
const deserialized = serialized.split(' ')
// we want policies and deserialized to both be `[]`
// but policies is `[]` while deserialized is `['']`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep yep! nice catch. realized the separator is an issue to start with and ended up finding this too.

@devinivy devinivy merged commit 53621f8 into main Jan 3, 2025
10 checks passed
@devinivy devinivy deleted the ozone-action-policy-association branch January 3, 2025 01:46
@github-actions github-actions bot mentioned this pull request Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants