mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-12 17:54:32 +00:00
Enable group chats
Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
parent
8345a0e8e9
commit
5795ca8d1a
1
.env.e2e
1
.env.e2e
@ -8,6 +8,7 @@ POW_TIME=1
|
||||
DEFAULT_NETWORK=testnet_rpc
|
||||
DEBUG_WEBVIEW=1
|
||||
GROUP_CHATS_ENABLED=1
|
||||
PAIRING_ENABLED=1
|
||||
EXTENSIONS=1
|
||||
PFS_ENCRYPTION_ENABLED=0
|
||||
ERC20_CONTRACT_WARNINGS=1
|
||||
|
@ -7,7 +7,8 @@ POW_TARGET=0.002
|
||||
POW_TIME=1
|
||||
DEFAULT_NETWORK=mainnet_rpc
|
||||
DEBUG_WEBVIEW=1
|
||||
GROUP_CHATS_ENABLED=0
|
||||
PAIRING_ENABLED=1
|
||||
GROUP_CHATS_ENABLED=1
|
||||
MAINNET_WARNING_ENABLED=1
|
||||
EXTENSIONS=1
|
||||
PFS_ENCRYPTION_ENABLED=0
|
||||
|
@ -9,7 +9,8 @@ POW_TARGET=0.002
|
||||
POW_TIME=1
|
||||
DEFAULT_NETWORK=mainnet_rpc
|
||||
DEBUG_WEBVIEW=0
|
||||
GROUP_CHATS_ENABLED=0
|
||||
GROUP_CHATS_ENABLED=1
|
||||
PAIRING_ENABLED=1
|
||||
MAINNET_WARNING_ENABLED=1
|
||||
EXTENSIONS=1
|
||||
PFS_ENCRYPTION_ENABLED=0
|
||||
|
@ -25,7 +25,7 @@
|
||||
;; not a group chat
|
||||
(or (not (and group-chat (not public?)))
|
||||
;; if it's a group chat
|
||||
(utils.config/group-chats-enabled? dev-mode?)))
|
||||
utils.config/group-chats-enabled?))
|
||||
(assoc acc chat-id (if-let [contact (get contacts chat-id)]
|
||||
(-> chat
|
||||
(assoc :name (:name contact))
|
||||
|
@ -381,7 +381,7 @@
|
||||
membership-updates] :as membership-update}
|
||||
sender-signature]
|
||||
(let [dev-mode? (get-in cofx [:db :account/account :dev-mode?])]
|
||||
(when (and (config/group-chats-enabled? dev-mode?)
|
||||
(when (and config/group-chats-enabled?
|
||||
(valid-chat-id? chat-id (extract-creator membership-update)))
|
||||
(let [previous-chat (get-in cofx [:db :chats chat-id])
|
||||
all-updates (clojure.set/union (set (:membership-updates previous-chat))
|
||||
|
@ -110,7 +110,7 @@
|
||||
;; We don't check dev-mode? here as
|
||||
;; otherwise we would have to restart the node
|
||||
;; when the user enables it
|
||||
(config/group-chats-enabled? true)
|
||||
config/group-chats-enabled?
|
||||
(config/pairing-enabled? true)))
|
||||
|
||||
(and
|
||||
|
@ -23,14 +23,14 @@
|
||||
:on-press #(re-frame/dispatch [:navigate-to :new-chat])}]
|
||||
[action-button/action-separator]
|
||||
;; Hide behind flag (false by default), till everything is fixed in group chats
|
||||
(when (config/group-chats-enabled? dev-mode?)
|
||||
(when config/group-chats-enabled?
|
||||
[action-button/action-button
|
||||
{:label (i18n/label :t/start-group-chat)
|
||||
:accessibility-label :start-group-chat-button
|
||||
:icon :icons/contacts
|
||||
:icon-opts {:color colors/blue}
|
||||
:on-press #(re-frame/dispatch [:contact.ui/start-group-chat-pressed])}])
|
||||
(when (config/group-chats-enabled? dev-mode?)
|
||||
(when config/group-chats-enabled?
|
||||
[action-button/action-separator])
|
||||
[action-button/action-button
|
||||
{:label (i18n/label :t/new-public-group-chat)
|
||||
|
@ -92,7 +92,7 @@
|
||||
[react/image {:style styles/suggested-contact-image
|
||||
:source {:uri (:photo-path c)}}]
|
||||
[react/text {:style styles/new-contact-subtitle} (:name c)]]]))]]
|
||||
(when (config/group-chats-enabled? true) group-chat-section)
|
||||
(when config/group-chats-enabled? group-chat-section)
|
||||
^{:key "publicchat"}
|
||||
[react/view {:style styles/new-contact-title}
|
||||
[react/text {:style styles/new-contact-title-text
|
||||
|
@ -17,9 +17,7 @@
|
||||
|
||||
(def bootnodes-settings-enabled? (enabled? (get-config :BOOTNODES_SETTINGS_ENABLED "1")))
|
||||
(def rpc-networks-only? (enabled? (get-config :RPC_NETWORKS_ONLY "1")))
|
||||
(defn group-chats-enabled? [dev-mode?]
|
||||
(and (enabled? (get-config :GROUP_CHATS_ENABLED "0"))
|
||||
(or dev-mode? platform/desktop?)))
|
||||
(def group-chats-enabled? (enabled? (get-config :GROUP_CHATS_ENABLED "0")))
|
||||
(defn pairing-enabled? [dev-mode?]
|
||||
(and (enabled? (get-config :PAIRING_ENABLED "0"))
|
||||
(or dev-mode? platform/desktop?)))
|
||||
|
@ -29,7 +29,7 @@
|
||||
(is (= 3 (group-chats/get-last-clock-value {:db {:chats {chat-id {:last-clock-value 3}}}} chat-id))))
|
||||
|
||||
(deftest handle-group-membership-update-test
|
||||
(with-redefs [config/group-chats-enabled? (constantly true)]
|
||||
(with-redefs [config/group-chats-enabled? true]
|
||||
(testing "a brand new chat"
|
||||
(let [actual (->
|
||||
(group-chats/handle-membership-update {:now 0 :db {}} initial-message admin)
|
||||
|
@ -21,7 +21,7 @@
|
||||
(is (= "id" (:InstallationID actual))))))
|
||||
(testing "pfs & group chats disabled"
|
||||
(with-redefs [config/pfs-encryption-enabled? false
|
||||
config/group-chats-enabled? (constantly false)]
|
||||
config/group-chats-enabled? false]
|
||||
(testing "the user is not logged in"
|
||||
(let [actual (parse-node-config (node/start cofx nil))]
|
||||
(is (not (:PFSEnabled actual)))))
|
||||
@ -37,7 +37,7 @@
|
||||
(let [actual (parse-node-config (node/start cofx address))]
|
||||
(is (:PFSEnabled actual))))))
|
||||
(testing "group chats is enabled"
|
||||
(with-redefs [config/group-chats-enabled? (constantly true)]
|
||||
(with-redefs [config/group-chats-enabled? true]
|
||||
(testing "the user is not logged in"
|
||||
(let [actual (parse-node-config (node/start cofx nil))]
|
||||
(is (not (:PFSEnabled actual)))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user