From fa8fe11bd777b2dba6ca3f83f61b1af84bd1dfed Mon Sep 17 00:00:00 2001 From: Jan Herich Date: Mon, 26 Jun 2017 19:41:58 +0200 Subject: [PATCH] chat: fix broken chat delete logic (#1343) * chat: fix broken chat delete logic Previously, persisting the chat delete functionality was working only for group chats, where the `debug?` flag decided if delete was a real "hard" delete (deleting data from the realm database) or just marking with the `inactive` flag. However non-group chats were not deleted at all, which I believe is a bug fixed by this commit. * chat: fix broken chat delete logic Fix the branching logic with `if` instead of `when` --- src/status_im/chat/handlers.cljs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/status_im/chat/handlers.cljs b/src/status_im/chat/handlers.cljs index cdbdba4ba6..591b5538dc 100644 --- a/src/status_im/chat/handlers.cljs +++ b/src/status_im/chat/handlers.cljs @@ -392,10 +392,9 @@ (defn delete-chat! [_ [_ chat-id]] (let [{:keys [debug? group-chat]} (chats/get-by-id chat-id)] - (when group-chat - (if debug? - (chats/delete chat-id) - (chats/set-inactive chat-id))))) + (if (and (not debug?) group-chat) + (chats/set-inactive chat-id) + (chats/delete chat-id)))) (defn remove-pending-messages! [_ [_ chat-id]]