[#12334] Redirect to home instead of community page when come back from community channel

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2021-07-26 10:31:34 +02:00
parent e5477cd449
commit d6d4b28e1e
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
3 changed files with 8 additions and 7 deletions

View File

@ -211,14 +211,16 @@
(fx/defn navigate-to-chat (fx/defn navigate-to-chat
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data" "Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
{:events [:chat.ui/navigate-to-chat]} {:events [:chat.ui/navigate-to-chat]}
[{db :db :as cofx} chat-id] [{db :db :as cofx} chat-id dont-reset?]
(fx/merge cofx (fx/merge cofx
(close-chat (:current-chat-id db)) (close-chat (:current-chat-id db))
(fn [{:keys [db]}] (fn [{:keys [db]}]
{:db (assoc db :current-chat-id chat-id :ignore-close-chat true)}) {:db (assoc db :current-chat-id chat-id :ignore-close-chat true)})
(preload-chat-data chat-id) (preload-chat-data chat-id)
(navigation/change-tab :chat) #(when-not dont-reset?
(navigation/pop-to-root-tab :chat-stack) (navigation/change-tab % :chat))
#(when-not dont-reset?
(navigation/pop-to-root-tab % :chat-stack))
(navigation/navigate-to-cofx :chat nil))) (navigation/navigate-to-cofx :chat nil)))
(fx/defn handle-clear-history-response (fx/defn handle-clear-history-response
@ -279,7 +281,7 @@
(if (or (new-public-chat.db/valid-topic? topic) profile-public-key) (if (or (new-public-chat.db/valid-topic? topic) profile-public-key)
(if (active-chat? cofx topic) (if (active-chat? cofx topic)
(when-not dont-navigate? (when-not dont-navigate?
(navigate-to-chat cofx topic)) (navigate-to-chat cofx topic false))
(create-public-chat-go (create-public-chat-go
cofx cofx
topic topic

View File

@ -60,7 +60,7 @@
(fx/defn create-from-link (fx/defn create-from-link
[cofx {:keys [chat-id invitation-admin chat-name]}] [cofx {:keys [chat-id invitation-admin chat-name]}]
(if (get-in cofx [:db :chats chat-id :is-active]) (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") {::json-rpc/call [{:method (json-rpc/call-ext-method "createGroupChatFromInvitation")
:params [chat-name chat-id invitation-admin] :params [chat-name chat-id invitation-admin]
:js-response true :js-response true

View File

@ -145,9 +145,8 @@
;; unread indicator ;; unread indicator
(assoc home-item :public? true) (assoc home-item :public? true)
{:on-press (fn [] {:on-press (fn []
(re-frame/dispatch [:pop-to-root-tab :chat-stack])
(re-frame/dispatch [:dismiss-keyboard]) (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 [:search/home-filter-changed nil])
(re-frame/dispatch [:accept-all-activity-center-notifications-from-chat chat-id])) (re-frame/dispatch [:accept-all-activity-center-notifications-from-chat chat-id]))
:on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet