remove password from db
fix incorrect :bot field in commands and requests
This commit is contained in:
parent
666ec73959
commit
5dd2f899ad
|
@ -57,7 +57,7 @@
|
|||
(re-frame/reg-fx
|
||||
:update-message
|
||||
(fn [message]
|
||||
(msg-store/update message)))
|
||||
(msg-store/update-message message)))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:save-message
|
||||
|
@ -261,4 +261,4 @@
|
|||
(handlers/register-handler-fx
|
||||
:browse-link-from-message
|
||||
(fn [{{:keys [global-commands]} :db} [_ link]]
|
||||
{:browse [(:browse global-commands) link]}))
|
||||
{:browse [(:browse global-commands) link]}))
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
[status-im.utils.utils :refer [update-if-present]]
|
||||
[clojure.walk :refer [stringify-keys keywordize-keys]]
|
||||
[cljs.reader :refer [read-string]]
|
||||
[status-im.constants :as c])
|
||||
(:refer-clojure :exclude [update]))
|
||||
[status-im.constants :as c]))
|
||||
|
||||
(defn- user-statuses-to-map
|
||||
[user-statuses]
|
||||
|
@ -105,13 +104,17 @@
|
|||
(assoc acc message-id (read-string preview)))
|
||||
{})))
|
||||
|
||||
(defn- prepare-content [content]
|
||||
(pr-str
|
||||
(update content :params dissoc :password :password-confirmation)))
|
||||
|
||||
(defn save
|
||||
;; todo remove chat-id parameter
|
||||
[chat-id {:keys [message-id content] :as message}]
|
||||
(when-not (data-store/exists? message-id)
|
||||
(let [content' (if (string? content)
|
||||
content
|
||||
(pr-str content))
|
||||
(prepare-content content))
|
||||
message' (merge default-values
|
||||
message
|
||||
{:chat-id chat-id
|
||||
|
@ -119,7 +122,7 @@
|
|||
:timestamp (timestamp)})]
|
||||
(data-store/save message'))))
|
||||
|
||||
(defn update
|
||||
(defn update-message
|
||||
[{:keys [message-id] :as message}]
|
||||
(when (data-store/exists? message-id)
|
||||
(let [message (update-if-present message :user-statuses vals)]
|
||||
|
|
|
@ -45,8 +45,31 @@
|
|||
(log/debug "v17 Removing contact" (pr-str contact))
|
||||
(.delete new-realm contact)))
|
||||
|
||||
(defn command-with-wrong-bot? [bot command]
|
||||
(and
|
||||
(#{"transactor-personal" "transactor-group"} bot)
|
||||
(not (#{"send" "request"} command))))
|
||||
|
||||
(defn update-commands [new-realm content-type]
|
||||
(some-> new-realm
|
||||
(.objects "message")
|
||||
(.filtered (str "content-type = \"" content-type "\""))
|
||||
(.map (fn [object _ _]
|
||||
(let [{:keys [bot command] :as content} (reader/read-string (aget object "content"))
|
||||
content' (cond->
|
||||
content
|
||||
|
||||
(= "password" command)
|
||||
(update :params dissoc :password :password-confirmation)
|
||||
|
||||
(command-with-wrong-bot? bot command)
|
||||
(assoc :bot nil))]
|
||||
(aset object "content" (pr-str content')))))))
|
||||
|
||||
;; NOTE(oskarth): Resets Realm for some dApps to be loaded by default_contacts.json instead.
|
||||
(defn migration [old-realm new-realm]
|
||||
(log/debug "migrating v17 account database: " old-realm new-realm)
|
||||
(doseq [contact ["oaken-water-meter" "gnosis" "Commiteth" "melonport"]]
|
||||
(remove-contact! new-realm contact)))
|
||||
(remove-contact! new-realm contact))
|
||||
(update-commands new-realm "command")
|
||||
(update-commands new-realm "command-request"))
|
||||
|
|
|
@ -302,7 +302,7 @@
|
|||
(assoc message :message-status status))
|
||||
;; we need to dissoc preview because it has been saved before
|
||||
(dissoc :preview))]
|
||||
(messages/update message')))))))
|
||||
(messages/update-message message')))))))
|
||||
|
||||
(defn update-message-status [status]
|
||||
(fn [db
|
||||
|
@ -347,8 +347,8 @@
|
|||
(fn [_ [_ {:keys [type id] :as pending-message}]]
|
||||
(pending-messages/save pending-message)
|
||||
(when (#{:message :group-message} type)
|
||||
(messages/update {:message-id id
|
||||
:delivery-status :pending}))))
|
||||
(messages/update-message {:message-id id
|
||||
:delivery-status :pending}))))
|
||||
(fn [db [_ {:keys [type id to group-id]}]]
|
||||
(if (#{:message :group-message} type)
|
||||
(let [chat-id (or group-id to)
|
||||
|
|
Loading…
Reference in New Issue