mirror of
https://github.com/status-im/status-mobile.git
synced 2025-03-01 00:30:49 +00:00
[#7819] fix - avoid unnecessary effects when joining/syncing already active public chat
Signed-off-by: yenda <eric@status.im>
This commit is contained in:
parent
b44c86511e
commit
f9e5101426
@ -41,6 +41,12 @@
|
|||||||
([cofx chat-id]
|
([cofx chat-id]
|
||||||
(public-chat? (get-chat cofx chat-id))))
|
(public-chat? (get-chat cofx chat-id))))
|
||||||
|
|
||||||
|
(defn active-chat?
|
||||||
|
([chat]
|
||||||
|
(:is-active chat))
|
||||||
|
([cofx chat-id]
|
||||||
|
(active-chat? (get-chat cofx chat-id))))
|
||||||
|
|
||||||
(defn group-chat?
|
(defn group-chat?
|
||||||
([chat]
|
([chat]
|
||||||
(and (multi-user-chat? chat)
|
(and (multi-user-chat? chat)
|
||||||
@ -289,13 +295,16 @@
|
|||||||
(fx/defn start-public-chat
|
(fx/defn start-public-chat
|
||||||
"Starts a new public chat"
|
"Starts a new public chat"
|
||||||
[cofx topic {:keys [dont-navigate?] :as opts}]
|
[cofx topic {:keys [dont-navigate?] :as opts}]
|
||||||
|
(if (active-chat? cofx topic)
|
||||||
|
(when-not dont-navigate?
|
||||||
|
(navigate-to-chat cofx topic opts))
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
(add-public-chat topic)
|
(add-public-chat topic)
|
||||||
#(when-not dont-navigate?
|
#(when-not dont-navigate?
|
||||||
(navigate-to-chat % topic opts))
|
(navigate-to-chat % topic opts))
|
||||||
(public-chat/join-public-chat topic)
|
(public-chat/join-public-chat topic)
|
||||||
(when platform/desktop?
|
#(when platform/desktop?
|
||||||
(desktop.events/change-tab :home))))
|
(desktop.events/change-tab % :home)))))
|
||||||
|
|
||||||
(fx/defn disable-chat-cooldown
|
(fx/defn disable-chat-cooldown
|
||||||
"Turns off chat cooldown (protection against message spamming)"
|
"Turns off chat cooldown (protection against message spamming)"
|
||||||
|
@ -155,7 +155,6 @@
|
|||||||
(let [contacts (:contacts/contacts db)
|
(let [contacts (:contacts/contacts db)
|
||||||
contact-batches (partition-all contact-batch-n (vals contacts))]
|
contact-batches (partition-all contact-batch-n (vals contacts))]
|
||||||
(concat (mapv contact-batch->sync-installation-message contact-batches)
|
(concat (mapv contact-batch->sync-installation-message contact-batches)
|
||||||
|
|
||||||
[(sync-installation-account-message cofx)]
|
[(sync-installation-account-message cofx)]
|
||||||
(chats->sync-installation-messages cofx))))
|
(chats->sync-installation-messages cofx))))
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.accounts.db :as accounts.db]
|
[status-im.accounts.db :as accounts.db]
|
||||||
[status-im.chat.models :as chat]
|
[status-im.chat.models :as chat]
|
||||||
|
[status-im.pairing.core :as pairing]
|
||||||
[status-im.extensions.registry :as extensions.registry]
|
[status-im.extensions.registry :as extensions.registry]
|
||||||
[status-im.ui.components.list-selection :as list-selection]
|
[status-im.ui.components.list-selection :as list-selection]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
@ -65,7 +66,10 @@
|
|||||||
|
|
||||||
(fx/defn handle-public-chat [cofx public-chat]
|
(fx/defn handle-public-chat [cofx public-chat]
|
||||||
(log/info "universal-links: handling public chat" public-chat)
|
(log/info "universal-links: handling public chat" public-chat)
|
||||||
(chat/start-public-chat cofx public-chat {}))
|
(fx/merge
|
||||||
|
cofx
|
||||||
|
(chat/start-public-chat public-chat {})
|
||||||
|
(pairing/sync-public-chat public-chat)))
|
||||||
|
|
||||||
(fx/defn handle-view-profile [{:keys [db] :as cofx} public-key]
|
(fx/defn handle-view-profile [{:keys [db] :as cofx} public-key]
|
||||||
(log/info "universal-links: handling view profile" public-key)
|
(log/info "universal-links: handling view profile" public-key)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user