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

View File

@ -55,7 +55,10 @@
(conj [:offload-messages constants/timeline-chat-id]) (conj [:offload-messages constants/timeline-chat-id])
(:blocked contact) (: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)}) contacts)})
(fx/defn upsert-contact (fx/defn upsert-contact

View File

@ -79,8 +79,8 @@
(added? (get-in db [:contacts/contacts public-key])))) (added? (get-in db [:contacts/contacts public-key]))))
(defn blocked? (defn blocked?
([{:keys [system-tags]}] ([contact]
(contains? system-tags :contact/blocked)) (:blocked contact))
([db public-key] ([db public-key]
(blocked? (get-in db [:contacts/contacts 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>", "_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.89.7", "version": "v0.89.8",
"commit-sha1": "4de912babad60c8ac556277ffc79026fc4cabdc4", "commit-sha1": "e77371d7d2154128d84c9607895c13620b20b260",
"src-sha256": "17lkgq6rciq1snnxjflxy6wqianyi0wkgjdk6rplz5yy2y91rv7v" "src-sha256": "1w8m3391xdlv29spvzlavp3f47rzvi8syk6q9nklr028l67ib0qd"
} }