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