Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-14366] Deprecated active user state from billing state service #12273

Conversation

cturnbull-bitwarden
Copy link
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-14366

📔 Objective

This PR updates the BillingAccountProfileStateService to remove its dependency on ActiveUserStateProvider by requiring explicit user IDs when checking premium status. This change:

  1. Modifies the service's public observables to accept a userId parameter instead of relying on the active user state
  2. Removes the internal state tracking of the active user
  3. Updates all consumers of the service to pass the active user's ID by combining with AccountService.activeAccount$, often via a switchMap, or otherwise, firstValueFrom

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link
Contributor

github-actions bot commented Dec 6, 2024

Logo
Checkmarx One – Scan Summary & Detailse0bf3f45-8d1b-48bf-8dbd-1112155f7e06

New Issues

Severity Issue Source File / Package Checkmarx Insight
LOW Client_JQuery_Deprecated_Symbols /apps/browser/src/background/runtime.background.ts: 91 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /apps/browser/src/autofill/deprecated/overlay/pages/list/autofill-overlay-list.deprecated.ts: 393
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.html: 15

@cturnbull-bitwarden cturnbull-bitwarden marked this pull request as ready for review December 6, 2024 19:38
@cturnbull-bitwarden cturnbull-bitwarden requested review from a team as code owners December 6, 2024 19:38
audreyality

This comment was marked as resolved.

Copy link
Member

@gbubemismith gbubemismith left a comment

Choose a reason for hiding this comment

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

Just added a few suggestions and pointed out some failing tests. Thanks for working on this

libs/angular/src/vault/components/view.component.ts Outdated Show resolved Hide resolved
apps/web/src/app/vault/individual-vault/vault.component.ts Outdated Show resolved Hide resolved
cipher.organizationId == null &&
!(await firstValueFrom(this.accountProfileService.hasPremiumFromAnySource$))
) {
const account = await firstValueFrom(this.accountService.activeAccount$);
Copy link
Member

Choose a reason for hiding this comment

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

I think we can delete this and move the activeUserId declared on L155 out of the try scope

BTreston
BTreston previously approved these changes Jan 6, 2025
@JaredSnider-Bitwarden JaredSnider-Bitwarden removed the request for review from ike-kottlowski January 6, 2025 19:12
…e-provider

# Conflicts:
#	apps/desktop/src/vault/app/vault/vault.component.ts
…e-provider

# Conflicts:
#	apps/browser/src/vault/popup/components/action-buttons.component.ts
@cturnbull-bitwarden cturnbull-bitwarden merged commit 91d6963 into main Jan 7, 2025
84 of 86 checks passed
@cturnbull-bitwarden cturnbull-bitwarden deleted the billing/PM-14366/deprectete-active-user-state-provider branch January 7, 2025 15:25
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.