[#10868] ENS name is pending when tx has failed

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2020-06-29 14:01:48 +02:00
parent ac74cf01c5
commit 49744d89de
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
2 changed files with 25 additions and 7 deletions

View File

@ -303,3 +303,18 @@
(fx/merge cofx
(set-username-candidate (get-in db [:ens/registration :username] ""))
(navigation/navigate-to-cofx :ens-search {})))
(fx/defn remove-username
{:events [::remove-username]}
[{:keys [db] :as cofx} name]
(let [names (get-in db [:multiaccount :usernames] [])
preferred-name (get-in db [:multiaccount :preferred-name])
new-names (remove #(= name %) names)]
(fx/merge cofx
(multiaccounts.update/multiaccount-update
:usernames new-names
{})
(when (= name preferred-name)
(multiaccounts.update/multiaccount-update
:preferred-name (first new-names) {}))
(navigation/navigate-back))))

View File

@ -509,15 +509,18 @@
[section {:title (i18n/label :t/key)
:content public-key}]])
[react/view {:style {:margin-top 16 :margin-bottom 32}}
;;TODO: re-enable once feature is developped
#_[list/big-list-item {:text (i18n/label :t/ens-remove-username)
:subtext (i18n/label :t/ens-remove-hints)
:text-color colors/gray
;;TODO this is temporary fix for accounts with failed txs
;;we still need this for regular ens names (not pending) but we need to detach public key in the contract
(when pending?
[list/big-list-item {:text (i18n/label :t/ens-remove-username)
;:subtext (i18n/label :t/ens-remove-hints)
:text-color colors/red
:text-style {:font-weight "500"}
:icon :main-icons/close
:icon-color colors/gray
:hide-chevron? true}]
(when-not custom-domain?
:icon-color colors/red
:hide-chevron? true
:action-fn #(re-frame/dispatch [::ens/remove-username name])}])
(when (and (not custom-domain?) (not pending?))
[react/view {:style {:margin-top 18}}
[list/big-list-item {:text (i18n/label :t/ens-release-username)
:text-color (if releasable?