Remove redundant checks when adding contacts.

Hooks are now called exactly once per contact.
This commit is contained in:
akwizgran
2018-04-13 15:40:39 +01:00
parent 8c00f2417b
commit 85c11f8e1f
8 changed files with 35 additions and 104 deletions

View File

@@ -65,7 +65,7 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
public void createLocalState(Transaction txn) throws DbException {
if (db.containsGroup(txn, localGroup.getId())) return;
db.addGroup(txn, localGroup);
// Ensure we've set things up for any pre-existing contacts
// Set things up for any pre-existing contacts
for (Contact c : db.getContacts(txn)) addingContact(txn, c);
}
@@ -73,8 +73,6 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
public void addingContact(Transaction txn, Contact c) throws DbException {
// Create a group to share with the contact
Group g = getContactGroup(c);
// Return if we've already set things up for this contact
if (db.containsGroup(txn, g.getId())) return;
// Store the group and share it with the contact
db.addGroup(txn, g);
db.setGroupVisibility(txn, c.getId(), g.getId(), SHARED);