From d6d4b28e1eed8351a7183f150ef2c19134e4996e Mon Sep 17 00:00:00 2001 From: andrey Date: Mon, 26 Jul 2021 10:31:34 +0200 Subject: [PATCH] [#12334] Redirect to home instead of community page when come back from community channel Signed-off-by: andrey --- src/status_im/chat/models.cljs | 10 ++++++---- src/status_im/group_chats/core.cljs | 2 +- src/status_im/ui/screens/communities/community.cljs | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index a5f0ff40d0..0bfb0ca083 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -211,14 +211,16 @@ (fx/defn navigate-to-chat "Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data" {:events [:chat.ui/navigate-to-chat]} - [{db :db :as cofx} chat-id] + [{db :db :as cofx} chat-id dont-reset?] (fx/merge cofx (close-chat (:current-chat-id db)) (fn [{:keys [db]}] {:db (assoc db :current-chat-id chat-id :ignore-close-chat true)}) (preload-chat-data chat-id) - (navigation/change-tab :chat) - (navigation/pop-to-root-tab :chat-stack) + #(when-not dont-reset? + (navigation/change-tab % :chat)) + #(when-not dont-reset? + (navigation/pop-to-root-tab % :chat-stack)) (navigation/navigate-to-cofx :chat nil))) (fx/defn handle-clear-history-response @@ -279,7 +281,7 @@ (if (or (new-public-chat.db/valid-topic? topic) profile-public-key) (if (active-chat? cofx topic) (when-not dont-navigate? - (navigate-to-chat cofx topic)) + (navigate-to-chat cofx topic false)) (create-public-chat-go cofx topic diff --git a/src/status_im/group_chats/core.cljs b/src/status_im/group_chats/core.cljs index b5f324d6e2..423a50948c 100644 --- a/src/status_im/group_chats/core.cljs +++ b/src/status_im/group_chats/core.cljs @@ -60,7 +60,7 @@ (fx/defn create-from-link [cofx {:keys [chat-id invitation-admin chat-name]}] (if (get-in cofx [:db :chats chat-id :is-active]) - (models.chat/navigate-to-chat cofx chat-id) + (models.chat/navigate-to-chat cofx chat-id false) {::json-rpc/call [{:method (json-rpc/call-ext-method "createGroupChatFromInvitation") :params [chat-name chat-id invitation-admin] :js-response true diff --git a/src/status_im/ui/screens/communities/community.cljs b/src/status_im/ui/screens/communities/community.cljs index 38d2195511..605677b1b1 100644 --- a/src/status_im/ui/screens/communities/community.cljs +++ b/src/status_im/ui/screens/communities/community.cljs @@ -145,9 +145,8 @@ ;; unread indicator (assoc home-item :public? true) {:on-press (fn [] - (re-frame/dispatch [:pop-to-root-tab :chat-stack]) (re-frame/dispatch [:dismiss-keyboard]) - (re-frame/dispatch [:chat.ui/navigate-to-chat chat-id]) + (re-frame/dispatch [:chat.ui/navigate-to-chat chat-id true]) (re-frame/dispatch [:search/home-filter-changed nil]) (re-frame/dispatch [:accept-all-activity-center-notifications-from-chat chat-id])) :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet