D28178: [contacts] Fix ContactCreateJob with a photo

Igor Poboiko noreply at phabricator.kde.org
Sat Mar 21 09:45:43 GMT 2020


poboiko created this revision.
poboiko added a reviewer: dvratil.
Herald added a project: KDE PIM.
poboiko requested review of this revision.

REVISION SUMMARY
  When we run `ContactCreateJob`, the UID of a contact is not yet known.
  We can only add a photo only after we receive a reply from main create job.
  
  Also, since we also don't want the following race condition to trigger:
  
  1. Contact1 create request
  2. Contact1 reply, Photo1 change request, Contact2 create request
  3. Contact2 reply, Photo2 change request
  4. Photo1 reply (here both `currentContact` and `lastContact` is Contact2)
  5. Photo2 reply
  
  we only go for next contact after the previous has been fully procesed:
  
  1. Contact1 create request
  2. Contact1 reply, Photo1 change request
  3. Photo1 reply, Contact2 create request
  4. Contact2 reply, Photo2 change request
  5. Photo2 reply

TEST PLAN
  Without patch:
  
  1. Create a contact with photo inside KAddressBook
  2. Check Web UI: no photo is set, sometimes bunch of contacts get created (?)
  
  With patch:
  
  2. Observe a single contact with a proper photo being set

REPOSITORY
  R477 KGAPI Library

BRANCH
  create-contact-photo (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D28178

AFFECTED FILES
  src/contacts/contactcreatejob.cpp

To: poboiko, dvratil
Cc: kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200321/650f57b4/attachment.html>


More information about the kde-pim mailing list