1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 02:03:39 +00:00

[PM-29164] Access Intelligence display for only enterprise (#17807)

* Access Intelligence display for only enterprise

* modifying the access intelligence routing to properly match. Added documentation.

* tasks remove useriskinsights flag

* fixing tasks test cases

* tasks should only check for enterprise

* fixing uncommitted changes

* reverting unecessary change from all activites

* adding back missing test case
This commit is contained in:
Tom
2025-12-04 19:04:26 -05:00
committed by GitHub
parent 2bf9e3f6df
commit d32365fbba
8 changed files with 48 additions and 22 deletions

View File

@@ -51,10 +51,10 @@ describe("Default task service", () => {
mockGetAllOrgs$.mockReturnValue(
new BehaviorSubject([
{
useAccessIntelligence: false,
canUseAccessIntelligence: false,
},
{
useAccessIntelligence: true,
canUseAccessIntelligence: true,
},
] as Organization[]),
);
@@ -70,10 +70,10 @@ describe("Default task service", () => {
mockGetAllOrgs$.mockReturnValue(
new BehaviorSubject([
{
useAccessIntelligence: false,
canUseAccessIntelligence: false,
},
{
useAccessIntelligence: false,
canUseAccessIntelligence: false,
},
] as Organization[]),
);
@@ -91,17 +91,17 @@ describe("Default task service", () => {
mockGetAllOrgs$.mockReturnValue(
new BehaviorSubject([
{
useAccessIntelligence: true,
canUseAccessIntelligence: true,
},
] as Organization[]),
);
});
it("should return an empty array if tasks are not enabled", async () => {
it("should return no tasks if not present and canUserAccessIntelligence is false", async () => {
mockGetAllOrgs$.mockReturnValue(
new BehaviorSubject([
{
useAccessIntelligence: false,
canUseAccessIntelligence: false,
},
] as Organization[]),
);
@@ -111,7 +111,6 @@ describe("Default task service", () => {
const result = await firstValueFrom(tasks$("user-id" as UserId));
expect(result.length).toBe(0);
expect(mockApiSend).not.toHaveBeenCalled();
});
it("should fetch tasks from the API when the state is null", async () => {
@@ -163,17 +162,17 @@ describe("Default task service", () => {
mockGetAllOrgs$.mockReturnValue(
new BehaviorSubject([
{
useAccessIntelligence: true,
canUseAccessIntelligence: true,
},
] as Organization[]),
);
});
it("should return an empty array if tasks are not enabled", async () => {
it("should return no tasks if not present and canUserAccessIntelligence is false", async () => {
mockGetAllOrgs$.mockReturnValue(
new BehaviorSubject([
{
useAccessIntelligence: false,
canUseAccessIntelligence: false,
},
] as Organization[]),
);
@@ -183,7 +182,6 @@ describe("Default task service", () => {
const result = await firstValueFrom(pendingTasks$("user-id" as UserId));
expect(result.length).toBe(0);
expect(mockApiSend).not.toHaveBeenCalled();
});
it("should filter tasks to only pending tasks", async () => {

View File

@@ -48,7 +48,7 @@ export class DefaultTaskService implements TaskService {
tasksEnabled$ = perUserCache$((userId) => {
return this.organizationService.organizations$(userId).pipe(
map((orgs) => orgs.some((o) => o.useAccessIntelligence)),
map((orgs) => orgs.some((o) => o.canUseAccessIntelligence)),
distinctUntilChanged(),
);
});