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
1=== modified file 'daemon/historydaemon.cpp'
2--- daemon/historydaemon.cpp 2013-09-30 16:50:55 +0000
3+++ daemon/historydaemon.cpp 2013-10-03 15:00:26 +0000
4@@ -169,14 +169,7 @@
5 // get the threads for the events to notify their modifications
6 QString accountId = event[History::FieldAccountId].toString();
7 QString threadId = event[History::FieldThreadId].toString();
8- QVariantMap thread = getSingleThread(type, accountId, threadId);
9- if (!thread.isEmpty() && !threads.contains(thread)) {
10- threads << thread;
11- }
12-
13- // set the participants field in the event
14 QVariantMap savedEvent = event;
15- savedEvent[History::FieldParticipants] = thread[History::FieldParticipants];
16
17 // and finally write the event
18 switch (type) {
19@@ -188,6 +181,15 @@
20 break;
21 }
22
23+ // only get the thread AFTER the event is written to make sure it is up-to-date
24+ QVariantMap thread = getSingleThread(type, accountId, threadId);
25+ threads.removeAll(thread);
26+ threads << thread;
27+
28+ // set the participants field in the event
29+ savedEvent[History::FieldParticipants] = thread[History::FieldParticipants];
30+
31+
32 // check if the event was a new one or a modification to an existing one
33 switch (result) {
34 case History::EventWriteCreated:

Subscribers

People subscribed via source and target branches