1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 05:13:29 +00:00

fix(devices): [PM-18757] resolve invalid device data error for Android devices

The device management screen was incorrectly evaluating the truthiness of 
DeviceView.type enum, causing "Invalid device data" errors when an Android 
device (type = 0) was present. Changed the check to explicitly verify for 
undefined values instead of truthy checks.

- Updated type checking to use explicit undefined checks
- Added translations for error messages
- Improved error handling with specific messages for missing data

Fixes PM-18757
This commit is contained in:
Alec Rippberger
2025-03-11 10:56:12 -05:00
committed by GitHub
parent 6caebc14e3
commit c765f22aef
2 changed files with 23 additions and 2 deletions

View File

@@ -180,8 +180,20 @@ export class DeviceManagementComponent {
private updateDeviceTable(devices: Array<DeviceView>): void {
this.dataSource.data = devices
.map((device: DeviceView): DeviceTableData | null => {
if (!device.id || !device.type || !device.creationDate) {
this.validationService.showError(new Error("Invalid device data"));
if (device.id == undefined) {
this.validationService.showError(new Error(this.i18nService.t("deviceIdMissing")));
return null;
}
if (device.type == undefined) {
this.validationService.showError(new Error(this.i18nService.t("deviceTypeMissing")));
return null;
}
if (device.creationDate == undefined) {
this.validationService.showError(
new Error(this.i18nService.t("deviceCreationDateMissing")),
);
return null;
}

View File

@@ -9412,6 +9412,15 @@
"deviceManagementDesc": {
"message": "Configure device management for Bitwarden using the implementation guide for your platform."
},
"deviceIdMissing": {
"message": "Device ID is missing"
},
"deviceTypeMissing": {
"message": "Device type is missing"
},
"deviceCreationDateMissing": {
"message": "Device creation date is missing"
},
"desktopRequired": {
"message": "Desktop required"
},