Enable group chats

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2018-11-28 14:05:02 +01:00
parent 8345a0e8e9
commit 5795ca8d1a
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
11 changed files with 15 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))

View File

@ -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))

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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?)))

View File

@ -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)

View File

@ -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)))))