Skip to content

feat(usage): show the over-limit banner to organisation admins - #8915

Open
TejasLamba2006 wants to merge 2 commits into
Flagsmith:mainfrom
TejasLamba2006:feat/org-limit-banner-admin-only
Open

TejasLamba2006 wants to merge 2 commits into
Flagsmith:mainfrom
TejasLamba2006:feat/org-limit-banner-admin-only

Conversation

@TejasLamba2006

@TejasLamba2006 TejasLamba2006 commented Nov 9, 2026 •

Copy link
Copy Markdown

Closes #8744.

Summary

  • Restrict the organisation over-limit banner to organisation admins.
  • Keep existing usage-page banner behavior.
  • Add coverage for admin and duplicate-banner visibility conditions.

Testing

  • Frontend Jest: 73 suites, 1060 passed, 2 todo.
  • ESLint passes for changed files.

@TejasLamba2006
TejasLamba2006 requested a review from a team as a code owner November 9, 2026 16:35
@TejasLamba2006
TejasLamba2006 requested review from talissoncosta and removed request for a team November 9, 2026 16:35
@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

@TejasLamba2006 is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

shouldShowOrganisationLimit returns true when the user is an admin and the pathname is not the organisation usage page while the usage dashboard is enabled. App uses this predicate to control whether it renders OrganisationLimit. Tests cover five combinations of admin status, pathname and usage-dashboard setting.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 2d77a

The banner is restricted to organisation admins while preserving usage-page suppression. No actionable merge-blocking issue remains in the supplied evidence.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2a485473-4837-4e3a-b22f-c6dc3c26a5d3
Commits

Reviewing files that changed from the base of the PR and between 8a060f2 and 2d77a1d.

Files selected for processing: 3

  • frontend/web/__tests__/routePaths.test.ts
  • frontend/web/components/App.js
  • frontend/web/routePaths.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 25fc7f09-82bc-483d-9698-d35f3a3fe63e
Commits

Reviewing files that changed from the base of the PR and between 13539af and 8a060f2.

Files selected for processing: 3

  • frontend/web/__tests__/routePaths.test.ts
  • frontend/web/components/App.js
  • frontend/web/routePaths.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment on lines +34 to +50
describe('shouldShowOrganisationLimit', () => {
it.each`
isAdmin | hasOwnQuotaBanner | shouldShow
${true} | ${false} | ${true}
${true} | ${true} | ${false}
${false} | ${false} | ${false}
${false} | ${true} | ${false}
`(
'admin=$isAdmin, own quota banner=$hasOwnQuotaBanner: $shouldShow',
({ hasOwnQuotaBanner, isAdmin, shouldShow }) => {
expect(shouldShowOrganisationLimit(isAdmin, hasOwnQuotaBanner)).toBe(
shouldShow,
)
},
)
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Trivial · Maintainability & Code Quality · Low value

Supported by static analysis

Script executed:

rg -n 'OrganisationLimit|shouldShowOrganisationLimit|AccountStore\.isAdmin\(' frontend/web/__tests__ frontend/web/components -g '*test*' -g '*spec*' | head -100

Repository: Flagsmith/flagsmith

Length of output: 446


Script executed:

git diff 13539afcb99c20b4351e26f215d01b49f2a9be03 8a060f262bca1f704f9d6c69365d92c6591a0e36 -- frontend/web/routePaths.ts frontend/web/components/App.js frontend/web/__tests__/routePaths.test.ts
printf '\n--- source files ---\n'
nl -ba frontend/web/__tests__/routePaths.test.ts | sed -n '1,160p'
nl -ba frontend/web/routePaths.ts | sed -n '1,160p'
nl -ba frontend/web/components/App.js | sed -n '1,110p;300,410p'
printf '\n--- test references ---\n'
rg -n -i -e 'OrganisationLimit' -e 'shouldShowOrganisationLimit' -e 'over.limit' -e 'quota banner' -e 'isAdmin' frontend --glob '*test*' --glob '*spec*' || test "$?" -eq 1

Repository: Flagsmith/flagsmith

Length of output: 17041


Script executed:

printf '%s\n' '--- App route and render context ---'
nl -ba frontend/web/components/App.js | sed -n '255,305p'
printf '%s\n' '--- OrganisationLimit source ---'
rg --files frontend/web/components -g 'OrganisationLimit*'
nl -ba frontend/web/components/OrganisationLimit.js | sed -n '1,220p'
printf '%s\n' '--- banner and App test candidates repository-wide ---'
rg -n -i -e 'OrganisationLimit' -e 'shouldShowOrganisationLimit' -e 'over.limit' -e 'quota banner' -e 'usage limit' --glob '!*.lock' --glob '!*.po' --glob '!*.json' --glob '!*.svg' --glob '*test*' --glob '*spec*' . || test "$?" -eq 1
printf '%s\n' '--- browser test directories and references ---'
rg --files | rg -i '(^|/)(cypress|e2e|playwright|integration)/|(^|/)[^/]*(app|usage)[^/]*\.(test|spec)\.'

Repository: Flagsmith/flagsmith

Length of output: 11554


Script executed:

nl -ba frontend/web/components/OrganisationLimit.tsx | sed -n '1,240p'
printf '\n--- Playwright quota and usage references ---\n'
rg -n -i -e 'quota' -e 'usage' -e 'limit' -e 'banner' -e 'organisationlimit' frontend/e2e/tests frontend/e2e/helpers || test "$?" -eq 1
printf '\n--- App imports in frontend tests ---\n'
rg -n -e "components/App" -e "from ['\"].*App['\"]" -e '<App[ />]' frontend --glob '*.test.*' --glob '*.spec.*' --glob '*.pw.ts' || test "$?" -eq 1

Repository: Flagsmith/flagsmith

Length of output: 4291


Test banner visibility through App.

Add rendered-banner tests for signed-in admins and non-admins on usage and non-usage routes. These helper tests pass literal booleans, so they would still pass if App supplied the wrong role or used the result incorrectly.

This branch has not been deployed

No deployments
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.

feat(usage): show the over-limit banner to organisation admins only

1 participant