From dca26b3350620dad09dd42696ccbec7643f60dbc Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 22 Oct 2020 17:12:13 +0300 Subject: [PATCH] [#11317] Prevent joining to pubchats with upper case letter in topic --- src/status_im/chat/models.cljs | 22 +++++++++++++--------- status-go-version.json | 6 +++--- translations/en.json | 4 +++- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index a72eba29f7..de496ebe21 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -15,7 +15,8 @@ [status-im.utils.fx :as fx] [status-im.utils.utils :as utils] [status-im.chat.models.loading :as loading] - [status-im.utils.types :as types])) + [status-im.utils.types :as types] + [status-im.ui.screens.add-new.new-public-chat.db :as new-public-chat.db])) (defn chats [] (:chats (types/json->clj (js/require "./chats.js")))) @@ -262,14 +263,17 @@ (fx/defn start-public-chat "Starts a new public chat" [cofx topic {:keys [dont-navigate?]}] - (if (active-chat? cofx topic) - (when-not dont-navigate? - (navigate-to-chat cofx topic)) - (fx/merge cofx - (add-public-chat topic) - (transport.filters/load-chat topic) - #(when-not dont-navigate? - (navigate-to-chat % topic))))) + (if (new-public-chat.db/valid-topic? topic) + (if (active-chat? cofx topic) + (when-not dont-navigate? + (navigate-to-chat cofx topic)) + (fx/merge cofx + (add-public-chat topic) + (transport.filters/load-chat topic) + #(when-not dont-navigate? + (navigate-to-chat % topic)))) + {:utils/show-popup {:title (i18n/label :t/cant-open-public-chat) + :content (i18n/label :t/invalid-public-chat-topic)}})) (fx/defn disable-chat-cooldown "Turns off chat cooldown (protection against message spamming)" diff --git a/status-go-version.json b/status-go-version.json index 5df4ce1868..326f80e563 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' instead", "owner": "status-im", "repo": "status-go", - "version": "v0.62.12", - "commit-sha1": "a36144983aa99cf14b8fd1a9969ee26a6aeff8f8", - "src-sha256": "0ggs7sqf5w7yr049lfdz7wr8aby0vzaybj3v0ln96f8njghvzwfq" + "version": "v0.62.13", + "commit-sha1": "7467ca7b103f685dd64d73485555f90c181a4484", + "src-sha256": "0gv9jxn5c5arnxdr33rfw2zkly9c2nyss59vbdyf444140bd6y6y" } diff --git a/translations/en.json b/translations/en.json index 4797518844..3467155e1b 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1280,5 +1280,7 @@ "name-optional": "Name (optional)", "mute": "Mute", "scan-tokens": "Scan tokens", - "warning-sending-to-contract-descr": "The address you entered is a smart contract, sending funds to this address may result in loss of funds. To interact with a DApp, open the DApp in the Status DApp Browser." + "warning-sending-to-contract-descr": "The address you entered is a smart contract, sending funds to this address may result in loss of funds. To interact with a DApp, open the DApp in the Status DApp Browser.", + "cant-open-public-chat": "Can't open public chat", + "invalid-public-chat-topic": "Invalid public chat topic" }