[#12673] Do not add unblocked user to added contacts

This commit is contained in:
Roman Volosovskyi 2021-10-05 14:44:28 +03:00
parent fe00971399
commit 61878376a3
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
4 changed files with 16 additions and 9 deletions

View File

@ -37,7 +37,9 @@
(let [fxs (map #(clean-up-chat public-key %) chats)]
(apply fx/merge
cofx
{:db (update db :chats dissoc public-key)}
{:db (-> db
(update :chats dissoc public-key)
(assoc-in [:contacts/contacts public-key :added] false))}
fxs)))
(fx/defn block-contact
@ -46,7 +48,9 @@
(let [contact (-> (contact.db/public-key->contact
(:contacts/contacts db)
public-key)
(assoc :last-updated now :blocked true))
(assoc :last-updated now
:blocked true
:added false))
from-one-to-one-chat? (not (get-in db [:chats (:current-chat-id db) :group-chat]))]
(fx/merge cofx
{:db (-> db
@ -62,7 +66,7 @@
(navigation/navigate-back)))))
(fx/defn unblock-contact
{:events [:contact.ui/unblock-contact-pressed]}
{:events [:contact.ui/unblock-contact-pressed ::contact-unblocked]}
[{:keys [db now] :as cofx} public-key]
(let [contact (-> (get-in db [:contacts/contacts public-key])
(assoc :last-updated now :blocked false))]

View File

@ -55,7 +55,10 @@
(conj [:offload-messages constants/timeline-chat-id])
(:blocked contact)
(conj [::contact.block/contact-blocked contact chats])))
(conj [::contact.block/contact-blocked contact chats])
(contact.db/blocked? db public-key)
(conj [::contact.block/contact-unblocked public-key])))
contacts)})
(fx/defn upsert-contact

View File

@ -79,8 +79,8 @@
(added? (get-in db [:contacts/contacts public-key]))))
(defn blocked?
([{:keys [system-tags]}]
(contains? system-tags :contact/blocked))
([contact]
(:blocked contact))
([db public-key]
(blocked? (get-in db [:contacts/contacts public-key]))))

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v0.89.7",
"commit-sha1": "4de912babad60c8ac556277ffc79026fc4cabdc4",
"src-sha256": "17lkgq6rciq1snnxjflxy6wqianyi0wkgjdk6rplz5yy2y91rv7v"
"version": "v0.89.8",
"commit-sha1": "e77371d7d2154128d84c9607895c13620b20b260",
"src-sha256": "1w8m3391xdlv29spvzlavp3f47rzvi8syk6q9nklr028l67ib0qd"
}