[Fixes #10751] Remove messages & list when blocking

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2020-06-03 14:39:27 +02:00
parent 39cc56dd10
commit f1272f4d49
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
1 changed files with 4 additions and 6 deletions

View File

@ -23,19 +23,17 @@
(fn [[message-id {:keys [from]}]]
(when (= from public-key)
message-id))
(get-in db [:chats chat-id :messages]))
(get-in db [:messages chat-id]))
db (-> db
;; remove messages
(update-in [:chats chat-id :messages]
(update-in [:messages chat-id]
#(apply dissoc % removed-messages-ids))
;; remove message groups
(update-in [:chats chat-id]
dissoc :message-list)
(update-in [:chats chat-id]
assoc
:unviewed-messages-count unviewed-messages-count
:last-message last-message))]
{:db (update-in db [:chats chat-id :message-list] message-list/add-many (vals (get-in db [:chats chat-id :messages])))}))
{:db (assoc-in db [:message-lists chat-id]
(message-list/add-many nil (vals (get-in db [:messages chat-id]))))}))
(fx/defn contact-blocked
{:events [::contact-blocked]}