Merge pull request #424 from status-im/bug/#421

Fix for inconsistent gap between messages (#421)
This commit is contained in:
Roman Volosovskyi 2016-11-08 18:30:48 +02:00 committed by GitHub
commit 0a33da12be
2 changed files with 8 additions and 8 deletions

View File

@ -398,7 +398,7 @@
(fn [db [_ {:keys [chat-id clock-value] :as opts}]]
(let [chat (if (chats/exists? chat-id)
(let [{old-clock-value :clock-value :as chat} (chats/get-by-id chat-id)]
(assoc chat :clock-value (+ (max old-clock-value clock-value)) 1))
(assoc chat :clock-value (max old-clock-value clock-value)))
(prepare-chat db chat-id opts))]
(chats/save chat)
(update-in db [:chats chat-id] merge chat))))

View File

@ -211,8 +211,8 @@
:keypair {:public public-key
:private private-key})))
(protocol/send-message! (assoc-in options
[:message :to] (:to message))))
(dispatch [:inc-clock chat-id]))))))
[:message :to] (:to message))))))
(dispatch [:inc-clock chat-id]))))
(register-handler ::send-command-protocol!
(u/side-effect!
@ -235,5 +235,5 @@
:keypair {:public public-key
:private private-key}))
(protocol/send-message! (assoc-in options
[:message :to] chat-id)))
(dispatch [:inc-clock chat-id])))))))
[:message :to] chat-id)))))
(dispatch [:inc-clock chat-id])))))