Bug 325303 - saving a distribution list (via "Save List") duplicates contacts
Summary: saving a distribution list (via "Save List") duplicates contacts
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: composer (show other bugs)
Version: Git (master)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-25 14:48 UTC by Jonathan Marten
Modified: 2013-10-14 15:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2013-09-25 14:48:54 UTC
I'm using a VCard Directory resource to store contacts.  The only way that I have found to create a contact group (aka distribution list) there is to start to compose a message in KMail, add the contact email addresses and then use the "Save List" button (that appears when there are 2 or more of them) to save the list.

After doing this, the contact group indeed appears in KAddressBook but each contact that it contains is duplicated.  The duplicate contacts contain only the name and the email address, regardless of any other data that the original contact contained.


Reproducible: Always

Steps to Reproduce:
1.  Start with an address book containing contact name/emails (plus any additional information) such as:

Foo Bar                  foo.bar@some.where
Name Surname      email2@another.com

2.  In KMail, open a new composer window (kmail --composer).

3.  Click "Select..." and pick each of those contacts in turn, then "Add as To".  Close the picker.

4.  Click "Save List...", enter a name for the list and pick the original address book to add to.

5.  In KAddressBook, observe that two duplicates of "Foo Bar" and "Name Surname" have appeared in the list.  Each one contains only their name and the selected email address (if they had more than one).

Actual Results:  
Duplicate contacts added as above.

Two VCF files with UIDs of the form {a04f7731-c090-45af-a05d-7119d3e03cda} will have appeared in the VCard Directory directory.  An Akonadi item of the form:

  ID        MIME type             Size        Modification Time  
  10103     application/x-vnd.kde.contactgroup  205 B       Wed Sep 25 14:40:25 2013 UTC

with payload:

<?xml version="1.0" encoding="UTF-8"?>
<contactGroup uid="{e1df8759-4f15-49f8-99a7-2751f67f8530}" name="test2-list">
    <contactReference uid="10101"/>
    <contactReference uid="10102"/>
</contactGroup>

will have been added to the database.


Expected Results:  
Creating a group from existing contacts should reference them, not duplicate anything.


I'm not sure where this bug really lies; it may be in KMail, akonadi or kaddressbook.  Since it can be duplicated via the KMail composer GUI, I'm initially reporting it in that category.
Comment 1 Jonathan Marten 2013-09-25 15:13:21 UTC
If it is relevant, I do not have Nepomuk PIM data indexing enabled.
Comment 2 Jonathan Marten 2013-10-09 10:46:09 UTC
https://git.reviewboard.kde.org/r/113180/
Comment 3 Jonathan Marten 2013-10-14 15:27:19 UTC
Git commit 9b2498f5447f968fac834c6df70a7e60b450c361 by Jonathan Marten.
Committed on 14/10/2013 at 15:25.
Pushed by marten into branch 'master'.

kmail: do not duplicate contacts when saving distribution list

Save a known contact by reference to its Akonadi ID plus possibly
email address (if it is not the preferrred one).  Only save an
unknown contact by name and email, do not add it to the address book.
Correctly handle the case where the email search returns multiple
contacts.

REVIEW:113180

M  +51   -28   messagecomposer/recipient/distributionlistdialog.cpp

http://commits.kde.org/kdepim/9b2498f5447f968fac834c6df70a7e60b450c361