fix Adding/removing user from contacts duplicating their messages in profile (#13897)
This commit is contained in:
parent
698e548c6d
commit
bc57298e07
|
@ -137,10 +137,11 @@
|
||||||
[{:ms 100 :dispatch [:chat/add-senders-to-chat-users (vals senders)]}]))}))
|
[{:ms 100 :dispatch [:chat/add-senders-to-chat-users (vals senders)]}]))}))
|
||||||
|
|
||||||
(defn reduce-js-statuses [db ^js message-js]
|
(defn reduce-js-statuses [db ^js message-js]
|
||||||
(let [chat-id (.-localChatId message-js)
|
(let [chat-id (.-localChatId message-js)
|
||||||
profile-initialized (get-in db [:pagination-info chat-id :messages-initialized?])
|
profile-initialized (get-in db [:pagination-info chat-id :messages-initialized?])
|
||||||
timeline-message (timeline-message? db chat-id)]
|
timeline-message (timeline-message? db chat-id)
|
||||||
(if (or profile-initialized timeline-message)
|
old-message (get-in db [:messages chat-id (.-id message-js)])]
|
||||||
|
(if (and (or profile-initialized timeline-message) (nil? old-message))
|
||||||
(let [{:keys [message-id] :as message} (data-store.messages/<-rpc (types/js->clj message-js))]
|
(let [{:keys [message-id] :as message} (data-store.messages/<-rpc (types/js->clj message-js))]
|
||||||
(cond-> db
|
(cond-> db
|
||||||
profile-initialized
|
profile-initialized
|
||||||
|
@ -233,4 +234,4 @@
|
||||||
{:db (reduce (fn [acc current]
|
{:db (reduce (fn [acc current]
|
||||||
(update-in acc [:messages (:chatId current)] remove-cleared-message (:clearedAt current)))
|
(update-in acc [:messages (:chatId current)] remove-cleared-message (:clearedAt current)))
|
||||||
db
|
db
|
||||||
cleared-histories)})
|
cleared-histories)})
|
||||||
|
|
Loading…
Reference in New Issue