Backend/moderation: add from_visibility filter to SetUserContentVisibility - #8470
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ility Lets admins narrow a bulk visibility sweep to states currently at one of the given visibilities. Empty list preserves existing behavior (sweeps any).
Use a set comprehension and a single None check instead of an explicit loop.
Avoids KeyError on unknown enum ints; the None-in-set check already covers it.
57ff126 to
a820b56
Compare
📝 Release NotesThis PR does not need to be included in release notes. Reason: This change adds a targeted moderation API filter for admins to bulk-change content visibility based on current visibility state. It is an internal backend moderation tool, not something regular end users would notice, and it does not represent a major user-facing feature or broadly significant infrastructure improvement. 🤖 Bot Debug InformationModel: |
Adds an optional
from_visibilityrepeated field toSetUserContentVisibilityReqthat narrows the bulk sweep to moderation states currently at one of the given visibilities. An empty list preserves the existing behavior of sweeping any visibility.This lets admins do targeted transitions (e.g. flip only currently-
visiblecontent toshadowed) without touching content that's already been moderated to a different state.Testing
Explain how you tested this PR and give clear steps so the reviewer can replicate.
MODERATION_VISIBILITY_UNSPECIFIEDin the filter list.make format,make mypy, anduv run pytest src/tests/test_moderation.pyall pass locally.Backend checklist
developif necessary for linear migration historyFor maintainers
This PR was created with the Couchers PR skill.