mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
Switch Notifications to only connect on unlocked (#13913)
This commit is contained in:
@@ -225,9 +225,10 @@ describe("NotificationsService", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
{ initialStatus: AuthenticationStatus.Locked, updatedStatus: AuthenticationStatus.Unlocked },
|
// Temporarily rolling back notifications being connected while locked
|
||||||
{ initialStatus: AuthenticationStatus.Unlocked, updatedStatus: AuthenticationStatus.Locked },
|
// { initialStatus: AuthenticationStatus.Locked, updatedStatus: AuthenticationStatus.Unlocked },
|
||||||
{ initialStatus: AuthenticationStatus.Locked, updatedStatus: AuthenticationStatus.Locked },
|
// { initialStatus: AuthenticationStatus.Unlocked, updatedStatus: AuthenticationStatus.Locked },
|
||||||
|
// { initialStatus: AuthenticationStatus.Locked, updatedStatus: AuthenticationStatus.Locked },
|
||||||
{ initialStatus: AuthenticationStatus.Unlocked, updatedStatus: AuthenticationStatus.Unlocked },
|
{ initialStatus: AuthenticationStatus.Unlocked, updatedStatus: AuthenticationStatus.Unlocked },
|
||||||
])(
|
])(
|
||||||
"does not re-connect when the user transitions from $initialStatus to $updatedStatus",
|
"does not re-connect when the user transitions from $initialStatus to $updatedStatus",
|
||||||
@@ -252,7 +253,11 @@ describe("NotificationsService", () => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it.each([AuthenticationStatus.Locked, AuthenticationStatus.Unlocked])(
|
it.each([
|
||||||
|
// Temporarily disabling notifications connecting while in a locked state
|
||||||
|
// AuthenticationStatus.Locked,
|
||||||
|
AuthenticationStatus.Unlocked,
|
||||||
|
])(
|
||||||
"connects when a user transitions from logged out to %s",
|
"connects when a user transitions from logged out to %s",
|
||||||
async (newStatus: AuthenticationStatus) => {
|
async (newStatus: AuthenticationStatus) => {
|
||||||
emitActiveUser(mockUser1);
|
emitActiveUser(mockUser1);
|
||||||
|
|||||||
@@ -123,13 +123,13 @@ export class DefaultNotificationsService implements NotificationsServiceAbstract
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method name is a lie currently as we also have an access token
|
||||||
|
// when locked, this is eventually where we want to be but it increases load
|
||||||
|
// on signalR so we are rolling back until we can move the load of browser to
|
||||||
|
// web push.
|
||||||
private hasAccessToken$(userId: UserId) {
|
private hasAccessToken$(userId: UserId) {
|
||||||
return this.authService.authStatusFor$(userId).pipe(
|
return this.authService.authStatusFor$(userId).pipe(
|
||||||
map(
|
map((authStatus) => authStatus === AuthenticationStatus.Unlocked),
|
||||||
(authStatus) =>
|
|
||||||
authStatus === AuthenticationStatus.Locked ||
|
|
||||||
authStatus === AuthenticationStatus.Unlocked,
|
|
||||||
),
|
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user