Skip to content

feat(platform): hide subscription banners for non-admin users#3145

Closed
ffirg wants to merge 2 commits intoansible:develfrom
ffirg:rfe-2823-upstream
Closed

feat(platform): hide subscription banners for non-admin users#3145
ffirg wants to merge 2 commits intoansible:develfrom
ffirg:rfe-2823-upstream

Conversation

@ffirg
Copy link
Copy Markdown

@ffirg ffirg commented Apr 28, 2026

Summary

Hide the "out of compliance" banner for non-admin users.

Non-admin users cannot act on subscription compliance issues, so displaying the banner to them:

  • Causes confusion ("should I stop using the platform?")
  • Creates unnecessary support burden

This change hides all subscription-related banners (compliance, grace period, expiry warnings) for non-superuser accounts.

Risk Analysis - REQUIRED

  • High
  • Medium
  • Low

Justification:

  • Change is isolated to banner visibility logic only
  • No API changes, no backend changes
  • Uses existing usePlatformActiveUser hook (already in use elsewhere)
  • All existing tests pass; 3 new tests added
  • Easy to revert if needed

Changes Made

  • platform/main/PlatformApp.tsx: Add is_superuser check to subscriptionBanner useMemo
  • platform/main/PlatformApp.test.tsx: Add 3 new test cases covering admin/non-admin scenarios

Implementation Details

Uses existing pattern from SubscriptionDetails.tsx:

const { activePlatformUser } = usePlatformActiveUser();
// ...
if (!activePlatformUser?.is_superuser) return null;

Test Plan

  • All 14 existing tests pass
  • New tests verify:
    • Non-admin users do NOT see compliance banners
    • Admin users DO see compliance banners
    • Non-admin users do NOT see subscription expiry banners
  • TypeScript compilation passes
  • ESLint passes

Manual Testing Steps

  1. Log in as a non-superuser account
  2. Ensure subscription is out of compliance (or will expire soon)
  3. Verify: No red/yellow subscription banner appears
  4. Log in as superuser account
  5. Verify: Subscription banner appears as expected

Screenshots

N/A - Banner visibility change only


🤖 Generated with Claude Code

JIRA: AAPRFE-2823
https://issues.redhat.com/browse/AAPRFE-2823

Non-admin users cannot act on subscription compliance issues, so
displaying the banner to them causes confusion and unnecessary
support burden. This change hides all subscription-related banners
(compliance, grace period, expiry warnings) for non-superuser accounts.

- Add is_superuser check to subscriptionBanner useMemo
- Add 3 new test cases covering admin/non-admin scenarios
- All existing tests continue to pass (default mock is superuser)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@marshmalien
Copy link
Copy Markdown
Member

/run-playwright

Copy link
Copy Markdown
Member

@marshmalien marshmalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled down locally and it looked good. Before we merge, since this is our upstream repo, could we remove all references to internal jira tickets:

  • PR title and description
  • Code comments in PlatformApp.tsx
  • Test names/comments in PlatformApp.test.tsx

Comment thread platform/main/PlatformApp.tsx Outdated
@aap-pde-ci-bot
Copy link
Copy Markdown
Collaborator

Currents dashboard

@ffirg ffirg changed the title feat(platform): hide subscription banners for non-admin users [AAPRFE-2823] feat(platform): hide subscription banners for non-admin users Apr 29, 2026
Remove AAPRFE-2823 references from comments and test names per
reviewer feedback - upstream repo should not contain internal tracker links.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ffirg
Copy link
Copy Markdown
Author

ffirg commented Apr 29, 2026

CI Failure Analysis

The Vitest (framework) failure is unrelated to this PR's changes. It's a pre-existing flaky test in the framework package:

Vitest caught 1 unhandled error during the test run.

ReferenceError: window is not defined
 ❯ PageToolbar/PageToolbarFilter.tsx:282:7

This is an async cleanup issue where React tries to update state after the test environment is torn down. This PR only modifies files in platform/main/ — no framework code was touched.

Vitest (platform) passed all tests including the 3 new tests for this feature.

Could you please re-run the failed check? These types of race conditions often pass on retry.


Re: SonarQube failure — this is expected for fork PRs (no access to repo secrets). Happy to discuss alternatives if needed.

@ffirg
Copy link
Copy Markdown
Author

ffirg commented Apr 30, 2026

Closing in favor of #3148 (pushed directly to repo to enable SonarQube checks)

@ffirg ffirg closed this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants