Fix merging of :message/message-persisted event
Previously `:message/message-persisted` was dispatched for each incoming message because its argument was not a vector. The event was renamed to `:message/messages-persisted`.
This commit is contained in:
parent
4981f4c346
commit
8754f72eba
|
@ -21,4 +21,4 @@
|
|||
db
|
||||
statuses)
|
||||
:data-store/tx [{:transaction (user-statuses-store/save-statuses-tx statuses)
|
||||
:success-event [:message/message-persisted js-obj]}]})))
|
||||
:success-event [:message/messages-persisted [js-obj]]}]})))
|
||||
|
|
|
@ -139,7 +139,8 @@
|
|||
:data-store/tx [(merge
|
||||
{:transaction (messages-store/save-message-tx prepared-message)}
|
||||
(when raw-message
|
||||
{:success-event [:message/message-persisted raw-message]}))]}
|
||||
{:success-event
|
||||
[:message/messages-persisted [raw-message]]}))]}
|
||||
(when (and platform/desktop?
|
||||
(not batch?)
|
||||
(not (system-message? prepared-message)))
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
[merged-values]))]))))))
|
||||
|
||||
(defn- merge-persistence-events [success-events]
|
||||
(merge-events-of-type success-events :message/message-persisted))
|
||||
(merge-events-of-type success-events :message/messages-persisted))
|
||||
|
||||
(defn- perform-transactions [raw-transactions realm]
|
||||
(let [success-events (keep :success-event raw-transactions)
|
||||
|
|
|
@ -791,9 +791,14 @@
|
|||
(chat.message/update-message-status cofx chat-id message-id status)))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:message/message-persisted
|
||||
(fn [cofx [_ raw-message]]
|
||||
(chat.message/confirm-message-processed cofx raw-message)))
|
||||
:message/messages-persisted
|
||||
(fn [cofx [_ raw-messages]]
|
||||
(apply fx/merge
|
||||
cofx
|
||||
(map
|
||||
(fn [raw-message]
|
||||
(chat.message/confirm-message-processed raw-message))
|
||||
raw-messages))))
|
||||
|
||||
;; signal module
|
||||
|
||||
|
|
Loading…
Reference in New Issue