fix log level config

the log level config for status-go wasn't saved in the node-config
as a result even though the setting looked applied in the UI it wasn't
in the node
This commit is contained in:
yenda 2019-09-13 16:09:36 +02:00
parent 49d882ba29
commit 9a2ba3009d
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
2 changed files with 10 additions and 4 deletions

View File

@ -12,10 +12,11 @@
new-settings (if log-level
(assoc settings :log-level log-level)
(dissoc settings :log-level))]
(multiaccounts.update/update-settings cofx
new-settings
(when (not= (node/get-log-level settings) (node/get-log-level new-settings))
{:success-event [:multiaccounts.update.callback/save-settings-success]}))))
(fx/merge cofx
(multiaccounts.update/update-settings new-settings
{})
(node/prepare-new-config {:on-success #(when (not= (node/get-log-level settings) (node/get-log-level new-settings))
(re-frame/dispatch [:logout]))}))))
(fx/defn show-change-log-level-confirmation
[{:keys [db]} {:keys [name value] :as log-level}]

View File

@ -169,6 +169,10 @@
(types/clj->json (get-multiaccount-node-config db)))
(fx/defn save-new-config
"Saves a new status-go config for the current account
This RPC method is the only way to change the node config of an account.
NOTE: it is better used indirectly through `prepare-new-config`, which will take
care of building up the proper config based on settings in app-db"
{:events [::save-new-config]}
[{:keys [db]} config {:keys [on-success]}]
{::json-rpc/call [{:method "settings_saveNodeConfig"
@ -176,6 +180,7 @@
:on-success on-success}]})
(fx/defn prepare-new-config
"Use this function to apply settings to the current account node config"
[{:keys [db]} {:keys [on-success]}]
{::prepare-new-config [(get-new-config db)
#(re-frame/dispatch [::save-new-config % {:on-success on-success}])]})