-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Merged
cturnbull-bitwarden
merged 26 commits into
main
from
billing/PM-14366/deprectete-active-user-state-provider
Jan 7, 2025
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
79f0f64
Updated billing state provider to not rely on ActiveUserStateProvider
cturnbull-bitwarden 056fbfe
Updated usages
cturnbull-bitwarden e943dc9
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden 79e02e1
Resolved browser build
cturnbull-bitwarden 5f5d38e
Resolved web build
cturnbull-bitwarden 4643a64
Resolved CLI build
cturnbull-bitwarden e9d9ec9
resolved desktop build
cturnbull-bitwarden 8232a72
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden 55e6f24
Update apps/cli/src/tools/send/commands/create.command.ts
cturnbull-bitwarden 39c8a0d
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden f9f4ceb
Move subscription visibility logic from component to service
cturnbull-bitwarden ad0c18e
Resolved unit test failures. Using existing userIds where present
cturnbull-bitwarden bc9dc37
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden 62662e3
Simplified activeUserId access
cturnbull-bitwarden 85af1e6
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden a9d072c
Resolved typescript strict errors
cturnbull-bitwarden 5f03ba7
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden 6a69690
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden d6c1494
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden e87e543
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden c84e4ee
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden f8976e3
Resolved broken unit test
cturnbull-bitwarden bc0ab99
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden cdb83c3
Resolved ts strict error
cturnbull-bitwarden bc195b3
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden 07807f7
Merge branch 'main' into billing/PM-14366/deprectete-active-user-statโฆ
cturnbull-bitwarden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,17 @@ describe("SendV2Component", () => { | |
CurrentAccountComponent, | ||
], | ||
providers: [ | ||
{ provide: AccountService, useValue: mock<AccountService>() }, | ||
{ | ||
provide: AccountService, | ||
useValue: { | ||
activeAccount$: of({ | ||
id: "123", | ||
email: "[email protected]", | ||
emailVerified: true, | ||
name: "Test User", | ||
}), | ||
}, | ||
}, | ||
{ provide: AuthService, useValue: mock<AuthService>() }, | ||
{ provide: AvatarService, useValue: mock<AvatarService>() }, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { ComponentFixture, TestBed } from "@angular/core/testing"; | ||
import { Router } from "@angular/router"; | ||
import { RouterTestingModule } from "@angular/router/testing"; | ||
import { BehaviorSubject } from "rxjs"; | ||
import { BehaviorSubject, of } from "rxjs"; | ||
|
||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; | ||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; | ||
|
@@ -10,7 +10,6 @@ import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abs | |
import { ProductTierType } from "@bitwarden/common/billing/enums"; | ||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; | ||
import { Utils } from "@bitwarden/common/platform/misc/utils"; | ||
import { FakeAccountService, mockAccountServiceWith } from "@bitwarden/common/spec"; | ||
import { CipherId, UserId } from "@bitwarden/common/types/guid"; | ||
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; | ||
import { CipherType } from "@bitwarden/common/vault/enums"; | ||
|
@@ -55,14 +54,22 @@ describe("OpenAttachmentsComponent", () => { | |
const showFilePopoutMessage = jest.fn().mockReturnValue(false); | ||
|
||
const mockUserId = Utils.newGuid() as UserId; | ||
const accountService: FakeAccountService = mockAccountServiceWith(mockUserId); | ||
const accountService = { | ||
activeAccount$: of({ | ||
id: mockUserId, | ||
email: "[email protected]", | ||
emailVerified: true, | ||
name: "Test User", | ||
}), | ||
}; | ||
|
||
beforeEach(async () => { | ||
openCurrentPagePopout.mockClear(); | ||
getCipher.mockClear(); | ||
showToast.mockClear(); | ||
getOrganization.mockClear(); | ||
showFilePopoutMessage.mockClear(); | ||
hasPremiumFromAnySource$.next(true); | ||
|
||
await TestBed.configureTestingModule({ | ||
imports: [OpenAttachmentsComponent, RouterTestingModule], | ||
|
@@ -96,7 +103,7 @@ describe("OpenAttachmentsComponent", () => { | |
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
beforeEach(async () => { | ||
fixture = TestBed.createComponent(OpenAttachmentsComponent); | ||
component = fixture.componentInstance; | ||
component.cipherId = "5555-444-3333" as CipherId; | ||
|
@@ -107,7 +114,7 @@ describe("OpenAttachmentsComponent", () => { | |
|
||
it("opens attachments in new popout", async () => { | ||
showFilePopoutMessage.mockReturnValue(true); | ||
|
||
component.canAccessAttachments = true; | ||
await component.ngOnInit(); | ||
|
||
await component.openAttachments(); | ||
|
@@ -120,7 +127,7 @@ describe("OpenAttachmentsComponent", () => { | |
|
||
it("opens attachments in same window", async () => { | ||
showFilePopoutMessage.mockReturnValue(false); | ||
|
||
component.canAccessAttachments = true; | ||
await component.ngOnInit(); | ||
|
||
await component.openAttachments(); | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oo, moving this out of the loop was a good idea; thanks ๐