[contacts] Fix ContactCreateJob with a photo

Authored by poboiko on Mar 21 2020, 9:42 AM.

Description

[contacts] Fix ContactCreateJob with a photo

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:

  1. Observe a single contact with a proper photo being set

Reviewers: dvratil

Reviewed By: dvratil

Subscribers: kde-pim

Tags: KDE PIM

Differential Revision: https://phabricator.kde.org/D28178

Details

Committed
poboikoMar 21 2020, 4:14 PM
Reviewer
dvratil
Differential Revision
D28178: [contacts] Fix ContactCreateJob with a photo
Parents
R477:e999f481773b: [calendar] Implement SyncToken for Calendar service
Branches
Unknown
Tags
Unknown