[#18752] fix: The W/O address shouldn't be in account selection (#18809)

This commit is contained in:
Mohsen 2024-02-14 20:37:52 +03:00 committed by GitHub
parent 8dc71f6432
commit 1d2c01c16b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 57 additions and 54 deletions

View File

@ -31,13 +31,13 @@
:token (:symbol balance))))) :token (:symbol balance)))))
(defn- account-item (defn- account-item
[{:keys [customization-color address name emoji]} _ _ [selected-addresses community-id]] [{:keys [color address name emoji]} _ _ [selected-addresses community-id]]
(let [balances (rf/sub [:communities/permissioned-balances-by-address community-id address])] (let [balances (rf/sub [:communities/permissioned-balances-by-address community-id address])]
[quo/account-permissions [quo/account-permissions
{:account {:name name {:account {:name name
:address address :address address
:emoji emoji :emoji emoji
:customization-color customization-color} :customization-color color}
:token-details (balances->components-props balances) :token-details (balances->components-props balances)
:checked? (contains? selected-addresses address) :checked? (contains? selected-addresses address)
:on-change #(rf/dispatch [:communities/toggle-selected-permission-address :on-change #(rf/dispatch [:communities/toggle-selected-permission-address
@ -51,7 +51,7 @@
(fn [] (fn []
(let [{:keys [name color images]} (rf/sub [:communities/community id]) (let [{:keys [name color images]} (rf/sub [:communities/community id])
{:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id]) {:keys [highest-permission-role]} (rf/sub [:community/token-gated-overview id])
accounts (rf/sub [:wallet/accounts-with-customization-color]) accounts (rf/sub [:wallet/accounts-without-watched-accounts])
selected-addresses (rf/sub [:communities/selected-permission-addresses id]) selected-addresses (rf/sub [:communities/selected-permission-addresses id])
highest-role-text (when highest-permission-role highest-role-text (when highest-permission-role
(i18n/label (communities.utils/role->translation-key (i18n/label (communities.utils/role->translation-key

View File

@ -370,7 +370,7 @@
(re-frame/reg-sub (re-frame/reg-sub
:communities/selected-permission-accounts :communities/selected-permission-accounts
(fn [[_ community-id]] (fn [[_ community-id]]
[(re-frame/subscribe [:wallet/accounts-with-customization-color]) [(re-frame/subscribe [:wallet/accounts-without-watched-accounts])
(re-frame/subscribe [:communities/selected-permission-addresses community-id])]) (re-frame/subscribe [:communities/selected-permission-addresses community-id])])
(fn [[accounts selected-permission-addresses]] (fn [[accounts selected-permission-addresses]]
(filter #(contains? selected-permission-addresses (:address %)) accounts))) (filter #(contains? selected-permission-addresses (:address %)) accounts)))

View File

@ -190,7 +190,7 @@
(rf/reg-sub (rf/reg-sub
:wallet/accounts-without-watched-accounts :wallet/accounts-without-watched-accounts
:<- [:wallet/accounts] :<- [:wallet/accounts-with-customization-color]
(fn [accounts] (fn [accounts]
(remove #(:watch-only? %) accounts))) (remove #(:watch-only? %) accounts)))

View File

@ -367,52 +367,55 @@
(assoc-in [:wallet :accounts] accounts) (assoc-in [:wallet :accounts] accounts)
(assoc-in [:wallet :networks] network-data))) (assoc-in [:wallet :networks] network-data)))
(is (is
(= (list (=
{:path "m/44'/60'/0'/0/0" (list
:emoji "😃" {:path "m/44'/60'/0'/0/0"
:key-uid "0x2f5ea39" :emoji "😃"
:address "0x1" :key-uid "0x2f5ea39"
:wallet false :address "0x1"
:name "Account One" :wallet false
:type :generated :name "Account One"
:watch-only? false :type :generated
:chat false :watch-only? false
:test-preferred-chain-ids #{5 420 421613} :chat false
:color :blue :test-preferred-chain-ids #{5 420 421613}
:hidden false :color :blue
:prod-preferred-chain-ids #{1 10 42161} :customization-color :blue
:network-preferences-names #{:ethereum :arbitrum :optimism} :hidden false
:position 0 :prod-preferred-chain-ids #{1 10 42161}
:clock 1698945829328 :network-preferences-names #{:ethereum :arbitrum :optimism}
:created-at 1698928839000 :position 0
:operable "fully" :clock 1698945829328
:mixedcase-address "0x7bcDfc75c431" :created-at 1698928839000
:public-key "0x04371e2d9d66b82f056bc128064" :operable "fully"
:removed false :mixedcase-address "0x7bcDfc75c431"
:tokens tokens-0x1} :public-key "0x04371e2d9d66b82f056bc128064"
{:path "m/44'/60'/0'/0/1" :removed false
:emoji "💎" :tokens tokens-0x1}
:key-uid "0x2f5ea39" {:path "m/44'/60'/0'/0/1"
:address "0x2" :emoji "💎"
:wallet false :key-uid "0x2f5ea39"
:name "Account Two" :address "0x2"
:type :generated :wallet false
:watch-only? false :name "Account Two"
:chat false :type :generated
:test-preferred-chain-ids #{5 420 421613} :watch-only? false
:color :purple :chat false
:hidden false :test-preferred-chain-ids #{5 420 421613}
:prod-preferred-chain-ids #{1 10 42161} :color :purple
:network-preferences-names #{:ethereum :arbitrum :optimism} :customization-color :purple
:position 1 :hidden false
:clock 1698945829328 :prod-preferred-chain-ids #{1 10 42161}
:created-at 1698928839000 :network-preferences-names #{:ethereum :arbitrum :optimism}
:operable "fully" :position 1
:mixedcase-address "0x7bcDfc75c431" :clock 1698945829328
:public-key "0x04371e2d9d66b82f056bc128064" :created-at 1698928839000
:removed false :operable "fully"
:tokens tokens-0x2}) :mixedcase-address "0x7bcDfc75c431"
(rf/sub [sub-name]))))) :public-key "0x04371e2d9d66b82f056bc128064"
:removed false
:tokens tokens-0x2})
(rf/sub [sub-name])))))
(h/deftest-sub :wallet/network-preference-details (h/deftest-sub :wallet/network-preference-details
[sub-name] [sub-name]

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>", "_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.174.5", "version": "v0.174.6",
"commit-sha1": "1ea2bd99d4c11f591df554c089aa9283b9742c59", "commit-sha1": "f95dd35d131f68645b7c4dc5fbcea955c16e25bd",
"src-sha256": "0b9411581gmxrrrbgbjk34db8xgz5qlhvrhp9hngggar1b7vmp1w" "src-sha256": "188chrifz4h3j6fpsrqq83v2vcnpp8y4282k9lhlrkkknfgwz5v2"
} }