-
Notifications
You must be signed in to change notification settings - Fork 572
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
Conversation
const includesTakedownLabel = (labels: Label[]) => { | ||
return labels.some((l) => l.val === TAKEDOWN_LABEL) | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
are we going to do the |
@@ -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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 👍
Apply takedowns to server responses based on if some content has a
!takedown
or!suspend
label from a configured labeler