fix linting
This commit is contained in:
@@ -243,7 +243,7 @@ interface ContactDbRecord {
|
||||
* Ensures a value is a string, never null or undefined
|
||||
*/
|
||||
function safeString(val: unknown): string {
|
||||
return typeof val === 'string' ? val : (val == null ? '' : String(val));
|
||||
return typeof val === "string" ? val : val == null ? "" : String(val);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,12 +258,13 @@ function contactToDbRecord(contact: Contact): ContactDbRecord {
|
||||
}
|
||||
|
||||
// Convert contactMethods array to JSON string, defaulting to empty array
|
||||
const contactMethodsStr = (contact.contactMethods != null
|
||||
? JSON.stringify(contact.contactMethods)
|
||||
: "[]");
|
||||
const contactMethodsStr =
|
||||
contact.contactMethods != null
|
||||
? JSON.stringify(contact.contactMethods)
|
||||
: "[]";
|
||||
|
||||
return {
|
||||
did: safeString(contact.did), // Required field, must be present
|
||||
did: safeString(contact.did), // Required field, must be present
|
||||
contactMethods: contactMethodsStr,
|
||||
name: safeString(contact.name),
|
||||
notes: safeString(contact.notes),
|
||||
@@ -271,7 +272,7 @@ function contactToDbRecord(contact: Contact): ContactDbRecord {
|
||||
publicKeyBase64: safeString(contact.publicKeyBase64),
|
||||
nextPubKeyHashB64: safeString(contact.nextPubKeyHashB64),
|
||||
seesMe: contact.seesMe ?? false,
|
||||
registered: contact.registered ?? false
|
||||
registered: contact.registered ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -288,7 +289,7 @@ function dbRecordToContact(record: ContactDbRecord): Contact {
|
||||
profileImageUrl: safeString(record.profileImageUrl),
|
||||
publicKeyBase64: safeString(record.publicKeyBase64),
|
||||
nextPubKeyHashB64: safeString(record.nextPubKeyHashB64),
|
||||
contactMethods: JSON.parse(record.contactMethods || "[]")
|
||||
contactMethods: JSON.parse(record.contactMethods || "[]"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -618,7 +619,10 @@ export default class ContactImportView extends Vue {
|
||||
await platformService.dbExec(sql, params);
|
||||
if (USE_DEXIE_DB) {
|
||||
// For Dexie, we need to parse the contactMethods back to an array
|
||||
await db.contacts.update(contact.did, dbRecordToContact(contactToStore));
|
||||
await db.contacts.update(
|
||||
contact.did,
|
||||
dbRecordToContact(contactToStore),
|
||||
);
|
||||
}
|
||||
updatedCount++;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user