Skip to content
Snippets Groups Projects
Commit d237c601 authored by Vincent Texier's avatar Vincent Texier
Browse files

[fix] fix certify identity duplicates in combobox and database

parent 2ad077de
No related branches found
No related tags found
1 merge request!7750.50.0
...@@ -23,6 +23,18 @@ class IdentitiesRepo: ...@@ -23,6 +23,18 @@ class IdentitiesRepo:
Commit an identity to the database Commit an identity to the database
:param sakia.data.entities.Identity identity: the identity to commit :param sakia.data.entities.Identity identity: the identity to commit
""" """
if identity.blockstamp != BlockUID.empty():
# Search same identity with empty blockstamp (incomplete)
same_with_empty_blockstamp = self.get_one(
currency=identity.currency,
uid=identity.uid,
pubkey=identity.pubkey,
blockstamp=BlockUID.empty()
)
# if same identity with empty blockstamp...
if same_with_empty_blockstamp:
# remove it to avoid duplicates
self.drop(same_with_empty_blockstamp)
identity_tuple = attr.astuple(identity) identity_tuple = attr.astuple(identity)
values = ",".join(["?"] * len(identity_tuple)) values = ",".join(["?"] * len(identity_tuple))
self._conn.execute( self._conn.execute(
...@@ -64,7 +76,7 @@ class IdentitiesRepo: ...@@ -64,7 +76,7 @@ class IdentitiesRepo:
def get_one(self, **search): def get_one(self, **search):
""" """
Get an existing identity in the database Get an existing identity in the database
:param dict search: the criterions of the lookup :param **kwargs search: the criterions of the lookup
:rtype: sakia.data.entities.Identity :rtype: sakia.data.entities.Identity
""" """
filters = [] filters = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment