Skip to content

Show purchased subscription storage in the admin panel #6158

Description

@rtibbles

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Admins see one Disk space figure per user, which is the admin-granted disk_space alone. Disk space a user has purchased through Stripe is invisible across the whole admin panel, so admins cannot tell a granted quota from a bought one.

Complexity: Medium
Target branch: hotfixes

Context

  • UserSubscription holds subscription_disk_space, stripe_subscription_status and current_period_end. User.get_effective_disk_space() adds the subscription space to disk_space when the subscription is active.
  • Three admin read paths report storage, and all three read disk_space alone: AdminUserViewSet.values (users table), the metadata action (user detail panel), and user_csv_fields / _build_csv_row (CSV export).
  • Count subscription storage towards the upload quota #6157 makes the quota check read the effective figure.

The Change

  • Purchased disk space should be a field of its own everywhere the admin panel reports storage, distinct from the admin-granted quota.
  • The detail panel should additionally carry the subscription's status and period end, so an admin can tell a live subscription from a lapsed one.

How to Get There

The admin panel is at /administration/, behind IsAdminUser.

  • Users table: /administration/#/users/
  • User detail panel: /administration/#/users/<userId>
  • CSV export: the Download CSV button on the users table, which calls admin_users_download_csv and requires at least one filter

A user with a subscription needs a UserSubscription row — either created through Stripe Checkout on Settings > Storage, or seeded directly.

Out of Scope

  • Editing purchased disk space from the admin panel — the new field is read-only, and the existing disk space edit dialog continues to edit disk_space only.
  • The quota enforcement fix.
  • The user-facing Settings > Storage page.
  • The Stripe checkout and webhook flows.
  • Creating a subscription from a payment entered manually in Stripe — follow-up issue.

Acceptance Criteria

General

  • The users table shows a Purchased disk space column, and the pre-existing column reads Granted disk space.
  • The Purchased disk space column header is not sortable.
  • The user detail panel shows purchased disk space, the subscription status as display text rather than the raw Stripe value, and the period end labelled "Renews on" when cancel_at_period_end is false and "Expires on" when it is true.
  • The detail panel's "X of Y" line and its progress bar use granted + purchased as the denominator.
  • The CSV export has one column each for purchased disk space, subscription status, and period end.
  • A user with no subscription renders KEmptyPlaceholder in both admin views and empty cells in the CSV.

Testing

  • Python tests cover the list endpoint, the metadata action and the CSV row builder, for an active subscription, a canceled subscription, and no subscription.
  • Jest tests cover the new table column and the new detail panel fields.

AI usage

I found this while investigating a subscriber's failed uploads and used Claude Code to trace the admin read paths and draft the issue section by section. I chose which surfaces to cover, the field labels and the out-of-scope boundary, and decided against sorting the new column.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions