<table><tr><td style="">poboiko created this revision.<br />poboiko added a reviewer: dvratil.<br />Herald added a project: KDE PIM.<br />poboiko requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D28178">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>When we run <tt style="background: #ebebeb; font-size: 13px;">ContactCreateJob</tt>, the UID of a contact is not yet known.<br />
We can only add a photo only after we receive a reply from main create job.</p>

<p>Also, since we also don't want the following race condition to trigger:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">Contact1 create request</li>
<li class="remarkup-list-item">Contact1 reply, Photo1 change request, Contact2 create request</li>
<li class="remarkup-list-item">Contact2 reply, Photo2 change request</li>
<li class="remarkup-list-item">Photo1 reply (here both <tt style="background: #ebebeb; font-size: 13px;">currentContact</tt> and <tt style="background: #ebebeb; font-size: 13px;">lastContact</tt> is Contact2)</li>
<li class="remarkup-list-item">Photo2 reply</li>
</ol>

<p>we only go for next contact after the previous has been fully procesed:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">Contact1 create request</li>
<li class="remarkup-list-item">Contact1 reply, Photo1 change request</li>
<li class="remarkup-list-item">Photo1 reply, Contact2 create request</li>
<li class="remarkup-list-item">Contact2 reply, Photo2 change request</li>
<li class="remarkup-list-item">Photo2 reply</li>
</ol></div></div><br /><div><strong>TEST PLAN</strong><div><p>Without patch:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">Create a contact with photo inside KAddressBook</li>
<li class="remarkup-list-item">Check Web UI: no photo is set, sometimes bunch of contacts get created (?)</li>
</ol>

<p>With patch:</p>

<ol class="remarkup-list" start="2">
<li class="remarkup-list-item">Observe a single contact with a proper photo being set</li>
</ol></div></div><br /><div><strong>REPOSITORY</strong><div><div>R477 KGAPI Library</div></div></div><br /><div><strong>BRANCH</strong><div><div>create-contact-photo (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28178">https://phabricator.kde.org/D28178</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/contacts/contactcreatejob.cpp</div></div></div><br /><div><strong>To: </strong>poboiko, dvratil<br /><strong>Cc: </strong>kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>