Skip to content

Backend/moderation: add from_visibility filter to SetUserContentVisibility - #8470

Merged
aapeliv merged 3 commits into
developfrom
backend/feature/set-user-content-visibility-from-filter
May 8, 2026
Merged

Backend/moderation: add from_visibility filter to SetUserContentVisibility#8470
aapeliv merged 3 commits into
developfrom
backend/feature/set-user-content-visibility-from-filter

Conversation

@aapeliv

@aapeliv aapeliv commented May 7, 2026

Copy link
Copy Markdown
Member

Adds an optional from_visibility repeated field to SetUserContentVisibilityReq that 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-visible content to shadowed) 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.

  • Added unit tests covering: filter that matches nothing, filter that matches one, multi-visibility filter, empty filter (any), and rejection of MODERATION_VISIBILITY_UNSPECIFIED in the filter list.
  • make format, make mypy, and uv run pytest src/tests/test_moderation.py all pass locally.

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

This PR was created with the Couchers PR skill.

@vercel

vercel Bot commented May 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
couchers Ready Ready Preview May 7, 2026 11:54pm

Request Review

aapeliv added 3 commits May 7, 2026 19:50
…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.
@aapeliv
aapeliv force-pushed the backend/feature/set-user-content-visibility-from-filter branch from 57ff126 to a820b56 Compare May 7, 2026 23:51
@aapeliv
aapeliv merged commit 4390882 into develop May 8, 2026
5 of 6 checks passed
@aapeliv
aapeliv deleted the backend/feature/set-user-content-visibility-from-filter branch May 8, 2026 00:04
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

📝 Release Notes

This 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 Information

Model: couchers.openai.gpt-5.4
Decision: exclude
Reasoning: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants