Merge lp:~boiko/history-service/fix_1234611 into lp:history-service

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 107
Merged at revision: 107
Proposed branch: lp:~boiko/history-service/fix_1234611
Merge into: lp:history-service
Diff against target: 34 lines (+9/-7)
1 file modified
daemon/historydaemon.cpp (+9/-7)
To merge this branch: bzr merge lp:~boiko/history-service/fix_1234611
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+189109@code.launchpad.net

Commit message

Make sure the ThreadsModified signal is emitted with the threads up-to-date.

Description of the change

Make sure the ThreadsModified signal is emitted with the threads up-to-date.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

looks good. tested on the device and it works fine.
+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'daemon/historydaemon.cpp'
--- daemon/historydaemon.cpp 2013-09-30 16:50:55 +0000
+++ daemon/historydaemon.cpp 2013-10-03 15:00:26 +0000
@@ -169,14 +169,7 @@
169 // get the threads for the events to notify their modifications169 // get the threads for the events to notify their modifications
170 QString accountId = event[History::FieldAccountId].toString();170 QString accountId = event[History::FieldAccountId].toString();
171 QString threadId = event[History::FieldThreadId].toString();171 QString threadId = event[History::FieldThreadId].toString();
172 QVariantMap thread = getSingleThread(type, accountId, threadId);
173 if (!thread.isEmpty() && !threads.contains(thread)) {
174 threads << thread;
175 }
176
177 // set the participants field in the event
178 QVariantMap savedEvent = event;172 QVariantMap savedEvent = event;
179 savedEvent[History::FieldParticipants] = thread[History::FieldParticipants];
180173
181 // and finally write the event174 // and finally write the event
182 switch (type) {175 switch (type) {
@@ -188,6 +181,15 @@
188 break;181 break;
189 }182 }
190183
184 // only get the thread AFTER the event is written to make sure it is up-to-date
185 QVariantMap thread = getSingleThread(type, accountId, threadId);
186 threads.removeAll(thread);
187 threads << thread;
188
189 // set the participants field in the event
190 savedEvent[History::FieldParticipants] = thread[History::FieldParticipants];
191
192
191 // check if the event was a new one or a modification to an existing one193 // check if the event was a new one or a modification to an existing one
192 switch (result) {194 switch (result) {
193 case History::EventWriteCreated:195 case History::EventWriteCreated:

Subscribers

People subscribed via source and target branches