From 3a444f40f355d7262f12a0809ad7b46c7c9be24a Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Mon, 2 Dec 2024 22:01:53 -0300 Subject: [PATCH] fix(group-chat): Missing group chat name when clearing history (#21684) Fix missing group name when user chooses drawer option to clear chat history from within the group chat screen. Fixes https://github.com/status-im/status-mobile/issues/21639 --- src/status_im/common/home/actions/view.cljs | 4 +- src/status_im/subs/chats.cljs | 41 ++++++++++----------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/status_im/common/home/actions/view.cljs b/src/status_im/common/home/actions/view.cljs index 61e6e03dba..251a711b46 100644 --- a/src/status_im/common/home/actions/view.cljs +++ b/src/status_im/common/home/actions/view.cljs @@ -159,10 +159,10 @@ :add-divider? needs-divider?})) (defn clear-history-entry - [chat-id needs-divider?] + [chat needs-divider?] (entry {:icon :i/delete :label (i18n/label :t/clear-history) - :on-press #(clear-history-action chat-id) + :on-press #(clear-history-action chat) :danger? true :sub-label nil :accessibility-label :clear-history diff --git a/src/status_im/subs/chats.cljs b/src/status_im/subs/chats.cljs index 32c27698f6..23df8a6b62 100644 --- a/src/status_im/subs/chats.cljs +++ b/src/status_im/subs/chats.cljs @@ -171,29 +171,26 @@ chat.events/public-chat? :public-chat :chat))) -(re-frame/reg-sub - :chats/current-chat-chat-view +(re-frame/reg-sub :chats/current-chat-chat-view :<- [:chats/current-chat] - (fn [current-chat] - (assoc - (select-keys current-chat - [:chat-id - :able-to-send-message? - :group-chat - :admins - :invitation-admin - :public? - :chat-type - :color - :contact-request-state - :chat-name - :synced-to - :synced-from - :community-id - :emoji - :description]) - :empty-chat? - (not (:last-message current-chat))))) + (fn [chat] + {:able-to-send-message? (:able-to-send-message? chat) + :admins (:admins chat) + :chat-id (:chat-id chat) + :chat-name (:chat-name chat) + :chat-type (:chat-type chat) + :color (:color chat) + :community-id (:community-id chat) + :contact-request-state (:contact-request-state chat) + :description (:description chat) + :emoji (:emoji chat) + :empty-chat? (not (:last-message chat)) + :group-chat (:group-chat chat) + :invitation-admin (:invitation-admin chat) + :name (:name chat) + :public? (:public? chat) + :synced-from (:synced-from chat) + :synced-to (:synced-to chat)})) (re-frame/reg-sub :chats/current-chat-exist?