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

Action !takedown labels in hydrator #2270

Merged
merged 19 commits into from
Mar 12, 2024
Merged

Action !takedown labels in hydrator #2270

merged 19 commits into from
Mar 12, 2024

Conversation

dholms
Copy link
Collaborator

@dholms dholms commented Mar 5, 2024

Apply takedowns to server responses based on if some content has a !takedown or !suspend label from a configured labeler

@dholms dholms changed the title Action takedown labels in hydrator Action !takedown labels in hydrator Mar 5, 2024
Comment on lines 773 to 775
const includesTakedownLabel = (labels: Label[]) => {
return labels.some((l) => l.val === TAKEDOWN_LABEL)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

So many labels pass through here and the hit rate on takedowns is so low that I wouldn't shy away from a little optimization... if it's straightforward. Maybe it would be easy to make the label hydration state a little richer to track which lists have a takedown? If it's not straightforward then I'm sure it's fine for the time being as-is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah I like it - I added a materialized isTakendown flag to the label hydration map

Also makes it easier to extend the functionality with either more labels that toggle the flag or other types of flags 👍

}

const includesTakedownLabel = (labels: Label[]) => {
return labels.some((l) => l.val === TAKEDOWN_LABEL)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it guaranteed that none of the labels here have a neg: true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be, but I'll add a check just in case 👍

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.

Sweet!

@bnewbold
Copy link
Collaborator

bnewbold commented Mar 5, 2024

are we going to do the !suspend label at the same time? for time-limited. I guess we could have just the one label with/without time-limits, but it feels a bit useful to make it really explicit in both protocol and UI/UX whether the takedown is temporary or not.

@dholms dholms changed the base branch from main to atproto-accept-labelers March 11, 2024 21:07
@dholms dholms marked this pull request as ready for review March 11, 2024 23:16
@@ -61,7 +61,9 @@ export class Views {
// ------------

actorIsTakendown(did: string, state: HydrationState): boolean {
return !!state.actors?.get(did)?.takedownRef
if (state.actors?.get(did)?.takedownRef) return true
if (state.labels?.get(did)?.isTakendown) return true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something we can punt for now—but if you are taken down via a label, perhaps you should receive the label rather than have it apply on the server side.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we can punt for now as we're still pairing those with pds takedowns

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But agreed, needs to be addressed soon 👍

Base automatically changed from atproto-accept-labelers to main March 12, 2024 21:04
@dholms dholms merged commit 3d32d1c into main Mar 12, 2024
10 checks passed
@dholms dholms deleted the takedown-labels branch March 12, 2024 21:19
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.

3 participants