Browse Source

fix: prevent duplicate contacts during QR code scanning

- Add explicit duplicate contact check before database insertion
- Show warning notification when duplicate contact is detected
- Return early to prevent duplicate database entries
- Improve user feedback for duplicate contact scenarios

This change ensures users get clear feedback when scanning an already-added contact and prevents duplicate entries in the contacts database.
invite-client-side
Matthew Raymer 3 days ago
parent
commit
ca9ca5fca7
  1. 20
      src/views/ContactQRScanShowView.vue

20
src/views/ContactQRScanShowView.vue

@ -574,6 +574,26 @@ export default class ContactQRScanShow extends Vue {
try {
logger.info("Opening database connection for new contact");
await db.open();
// Check if contact already exists
const existingContacts = await db.contacts.toArray();
const existingContact = existingContacts.find(c => c.did === contact.did);
if (existingContact) {
logger.info("Contact already exists", { did: contact.did });
this.$notify(
{
group: "alert",
type: "warning",
title: "Contact Exists",
text: "This contact has already been added to your list.",
},
3000,
);
return;
}
// Add new contact
await db.contacts.add(contact);
if (this.activeDid) {

Loading…
Cancel
Save