1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 14:23:32 +00:00

[PM-5450] Admin Console event collection (#10678)

* switch `collect` to `collectMany`

- The `collect` method in collection service tries to fetch the cipher via the passed `cipherId`. The cipher service fails within the admin console in some cases.

* add `getCipherAdmin` call to fetch ciphers not in a collection
This commit is contained in:
Nick Krantz
2024-09-30 13:42:33 -05:00
committed by GitHub
parent b54ec7a204
commit 8589cfd96e

View File

@@ -308,9 +308,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
this.folders$ = this.folderService.folderViews$; this.folders$ = this.folderService.folderViews$;
if (this.editMode && this.previousCipherId !== this.cipherId) { if (this.editMode && this.previousCipherId !== this.cipherId) {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. void this.eventCollectionService.collectMany(EventType.Cipher_ClientViewed, [this.cipher]);
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.eventCollectionService.collect(EventType.Cipher_ClientViewed, this.cipherId);
} }
this.previousCipherId = this.cipherId; this.previousCipherId = this.cipherId;
this.reprompt = this.cipher.reprompt !== CipherRepromptType.None; this.reprompt = this.cipher.reprompt !== CipherRepromptType.None;
@@ -551,12 +549,9 @@ export class AddEditComponent implements OnInit, OnDestroy {
if (this.editMode && this.showPassword) { if (this.editMode && this.showPassword) {
document.getElementById("loginPassword")?.focus(); document.getElementById("loginPassword")?.focus();
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. void this.eventCollectionService.collectMany(EventType.Cipher_ClientToggledPasswordVisible, [
// eslint-disable-next-line @typescript-eslint/no-floating-promises this.cipher,
this.eventCollectionService.collect( ]);
EventType.Cipher_ClientToggledPasswordVisible,
this.cipherId,
);
} }
} }
@@ -566,23 +561,18 @@ export class AddEditComponent implements OnInit, OnDestroy {
if (this.editMode && this.showTotpSeed) { if (this.editMode && this.showTotpSeed) {
document.getElementById("loginTotp")?.focus(); document.getElementById("loginTotp")?.focus();
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. void this.eventCollectionService.collectMany(EventType.Cipher_ClientToggledTOTPSeedVisible, [
// eslint-disable-next-line @typescript-eslint/no-floating-promises this.cipher,
this.eventCollectionService.collect( ]);
EventType.Cipher_ClientToggledTOTPSeedVisible,
this.cipherId,
);
} }
} }
async toggleCardNumber() { async toggleCardNumber() {
this.showCardNumber = !this.showCardNumber; this.showCardNumber = !this.showCardNumber;
if (this.showCardNumber) { if (this.showCardNumber) {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. void this.eventCollectionService.collectMany(
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.eventCollectionService.collect(
EventType.Cipher_ClientToggledCardNumberVisible, EventType.Cipher_ClientToggledCardNumberVisible,
this.cipherId, [this.cipher],
); );
} }
} }
@@ -591,12 +581,9 @@ export class AddEditComponent implements OnInit, OnDestroy {
this.showCardCode = !this.showCardCode; this.showCardCode = !this.showCardCode;
document.getElementById("cardCode").focus(); document.getElementById("cardCode").focus();
if (this.editMode && this.showCardCode) { if (this.editMode && this.showCardCode) {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. void this.eventCollectionService.collectMany(EventType.Cipher_ClientToggledCardCodeVisible, [
// eslint-disable-next-line @typescript-eslint/no-floating-promises this.cipher,
this.eventCollectionService.collect( ]);
EventType.Cipher_ClientToggledCardCodeVisible,
this.cipherId,
);
} }
} }
@@ -742,17 +729,17 @@ export class AddEditComponent implements OnInit, OnDestroy {
); );
if (typeI18nKey === "password") { if (typeI18nKey === "password") {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. void this.eventCollectionService.collectMany(EventType.Cipher_ClientCopiedPassword, [
// eslint-disable-next-line @typescript-eslint/no-floating-promises this.cipher,
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedPassword, this.cipherId); ]);
} else if (typeI18nKey === "securityCode") { } else if (typeI18nKey === "securityCode") {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. void this.eventCollectionService.collectMany(EventType.Cipher_ClientCopiedCardCode, [
// eslint-disable-next-line @typescript-eslint/no-floating-promises this.cipher,
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedCardCode, this.cipherId); ]);
} else if (aType === "H_Field") { } else if (aType === "H_Field") {
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. void this.eventCollectionService.collectMany(EventType.Cipher_ClientCopiedHiddenField, [
// eslint-disable-next-line @typescript-eslint/no-floating-promises this.cipher,
this.eventCollectionService.collect(EventType.Cipher_ClientCopiedHiddenField, this.cipherId); ]);
} }
return true; return true;