delete any open chats with removed default contacts; remove etherplay and commiteth

This commit is contained in:
Goran Jovic 2017-10-28 15:18:53 +02:00 committed by Oskar Thorén
parent 18ca23accc
commit a6f9eb6cea
2 changed files with 21 additions and 34 deletions

View File

@ -248,37 +248,8 @@
},
"groups": ["dapps"],
"description": "The future of work is now. Hire people or work yourself in return for ETH."
},
"Commiteth":
{
"name":
{
"en": "Commiteth"
},
"photo-path": "contacts://commiteth",
"dapp?": true,
"dapp-url":
{
"en": "https://commiteth.com"
},
"groups": ["dapps"],
"description": "CommitETH is a GitHub bounty bot that incentivizes pull request submissions by attaching ETH or any ERC20-compatible token to open issues in GitHub."
},
"Etherplay":
{
"name":
{
"en": "Etherplay"
},
"photo-path": "contacts://etherplay",
"dapp?": true,
"dapp-url":
{
"en": "http://test.etherplay.io"
},
"groups": ["dapps"],
"description": "A transparent skill game platform. Play games and win ETH!"
}
}

View File

@ -37,6 +37,21 @@
local-storage/schema
handler-data/schema])
(defn remove-chat-with-contact! [new-realm whisper-identity]
(when-let [chat-contact (some-> new-realm
(.objects "chat-contact")
(.filtered (str "identity = \"" whisper-identity "\""))
(aget 0))]
(log/debug "v17 Removing chat-contact with contact" (pr-str chat-contact))
(.delete new-realm chat-contact))
(when-let [chat (some-> new-realm
(.objects "chat")
(.filtered (str "chat-id = \"" whisper-identity "\""))
(aget 0))]
(log/debug "v17 Removing chat with contact" (pr-str chat))
(.delete new-realm chat)))
(defn remove-contact! [new-realm whisper-identity]
(when-let [contact (some-> new-realm
(.objects "contact")
@ -69,7 +84,8 @@
;; 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))
(doseq [contact-id ["oaken-water-meter" "gnosis" "Commiteth" "melonport" "Etherplay"]]
(remove-chat-with-contact! new-realm contact-id)
(remove-contact! new-realm contact-id))
(update-commands new-realm "command")
(update-commands new-realm "command-request"))