fix issue with username change after deletion

This commit is contained in:
otsmr 2025-10-16 23:22:58 +02:00
parent cb2f0d00a6
commit 402a8916f7

View file

@ -339,12 +339,18 @@ class ApiService {
} }
if (res.error == ErrorCode.UserIdNotFound && contactId != null) { if (res.error == ErrorCode.UserIdNotFound && contactId != null) {
Log.error('Contact deleted their account $contactId.'); Log.error('Contact deleted their account $contactId.');
await twonlyDB.contactsDao.updateContact( final contact = await twonlyDB.contactsDao
contactId, .getContactByUserId(contactId)
const ContactsCompanion( .getSingleOrNull();
deleted: Value(true), if (contact != null) {
), await twonlyDB.contactsDao.updateContact(
); contactId,
ContactsCompanion(
deleted: const Value(true),
username: Value('${contact.username} (${contact.userId})'),
),
);
}
} }
} }
return res; return res;