mirror of
https://github.com/bitwarden/browser
synced 2026-02-24 00:23:17 +00:00
feat(browser-approval): [PM-23620] Auth Request Answering Service - Correct text for notification.
This commit is contained in:
@@ -12,6 +12,7 @@ import { ActionsService } from "@bitwarden/common/platform/actions";
|
||||
import {
|
||||
ButtonLocation,
|
||||
SystemNotificationEvent,
|
||||
SystemNotificationPrefixes,
|
||||
SystemNotificationsService,
|
||||
} from "@bitwarden/common/platform/system-notifications/system-notifications.service";
|
||||
import { UserId } from "@bitwarden/user-core";
|
||||
@@ -31,9 +32,9 @@ export class AuthRequestAnsweringService implements AuthRequestAnsweringServiceA
|
||||
|
||||
async handleAuthRequestNotificationClicked(event: SystemNotificationEvent): Promise<void> {
|
||||
if (event.buttonIdentifier === ButtonLocation.NotificationButton) {
|
||||
// await this.systemNotificationsService.clear({
|
||||
// id: `authRequest_${event.id}`,
|
||||
// });
|
||||
await this.systemNotificationsService.clear({
|
||||
id: `${event.id}`,
|
||||
});
|
||||
await this.actionService.openPopup();
|
||||
}
|
||||
}
|
||||
@@ -54,10 +55,14 @@ export class AuthRequestAnsweringService implements AuthRequestAnsweringServiceA
|
||||
) {
|
||||
// TODO: Handled in 14934
|
||||
} else {
|
||||
// Get the user's email to include in the system notification
|
||||
const accounts = await firstValueFrom(this.accountService.accounts$);
|
||||
const emailForUser = accounts?.[userId]?.email;
|
||||
|
||||
await this.systemNotificationsService.create({
|
||||
id: `authRequest_${authRequestId}`,
|
||||
id: `${SystemNotificationPrefixes.AuthRequest}_${authRequestId}`,
|
||||
title: this.i18nService.t("accountAccessRequested"),
|
||||
body: "Pending Auth Request to Approve (i18n)",
|
||||
body: this.i18nService.t("confirmAccessAttempt", emailForUser),
|
||||
buttons: [],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
// This is currently tailored for chrome extension's api, if safari works
|
||||
export const SystemNotificationPrefixes = Object.freeze({
|
||||
AuthRequest: "authRequest",
|
||||
});
|
||||
|
||||
// This is currently tailored for Chrome extension's api, if Safari works
|
||||
// differently where clicking a notification button produces a different
|
||||
// identifier we need to reconcile that here.
|
||||
export const ButtonLocation = Object.freeze({
|
||||
|
||||
Reference in New Issue
Block a user