Skip to content

AO3-7512 Exclude banned users from total user count on the homepage#5942

Open
y7nieSEl5 wants to merge 2 commits into
otwcode:masterfrom
y7nieSEl5:AO3-7512
Open

AO3-7512 Exclude banned users from total user count on the homepage#5942
y7nieSEl5 wants to merge 2 commits into
otwcode:masterfrom
y7nieSEl5:AO3-7512

Conversation

@y7nieSEl5

Copy link
Copy Markdown

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7512

Purpose

The registered-user total shown on the homepage previously counted every user. This changes it to count only users who are not permanently banned, so the displayed figure reflects the active userbase.

  • Homepage#rounded_counts now counts User.where(banned: false) instead of User.count.
  • Adds a database index on users.banned to keep this count performant. This is a departure migration — it uses pt-online-schema-change on staging/production.

⚠️ Deploy note: This has a departure migration that should be run before the deploy.

The homepage counts are cached for 40 minutes (/v1/home/counts/user), so the displayed total will self-correct within ~40 minutes of deploy.

Testing Instructions

Per the Jira issue, this is hard to test on Staging, so it's covered by automated tests instead. No manual QA required.

New specs in spec/models/search/homepage_decorator_spec.rb under #rounded_counts:

  • counts users that are not banned
  • excludes banned users from the user count

bundle exec rspec spec/models/search/homepage_decorator_spec.rb

Credit

What name and pronouns should we use to credit you in the Archive of Our Own's Release Notes?

y7nieSEl5, she/her

If you have a Jira account, please include the same name in the "Full name"
field on your Jira profile, so we can assign you the issues you're working on.

Please note that if you do not fill in this section, we will use your GitHub account name and
they/them pronouns.

@github-actions github-actions Bot added Has Migrations Contains migrations and therefore needs special attention when deploying Awaiting Review labels Jul 22, 2026
@y7nieSEl5 y7nieSEl5 closed this Jul 22, 2026
@y7nieSEl5 y7nieSEl5 reopened this Jul 22, 2026
@sarken

sarken commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Hi, y7nieSEl5!

Thank you so much for this pull request. Someone will be along to review it soon.

In the meantime, I've updated the Jira issue status to In Review so no one mistakenly creates a duplicate pull request. If you'd like the ability to comment on, assign, and transition issues in the future, you're welcome to create a Jira account! It makes things a bit easier for us on the organizational side if the Full Name on your Jira account either closely matches the name you'd like us to credit in the release notes or includes it in parentheses, e.g. "Nickname (CREDIT NAME)."

Once you've done that (or if you've already done it -- Jira has been unreliable about showing us new accounts in the admin panel lately), you can either reply here or send an email to otw-coders@transformativeworks.org with your account name and email address and we'll set up the permissions for you.

Thanks again for contributing! If you have any questions, you can contact us at the same email address listed above.

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

Labels

Awaiting Review Has Migrations Contains migrations and therefore needs special attention when deploying Priority: Low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants