From 11d3bf094a90a8973ef63233357a06faf029d507 Mon Sep 17 00:00:00 2001 From: Parvesh Monu Date: Mon, 6 Dec 2021 18:34:13 +0530 Subject: [PATCH] Decline pending group invites from user, when user is blocked (#12878) --- src/status_im/contact/block.cljs | 13 ++++++++++--- src/status_im/data_store/contacts.cljs | 1 + src/status_im/transport/message/core.cljs | 4 +--- status-go-version.json | 6 +++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/status_im/contact/block.cljs b/src/status_im/contact/block.cljs index ef655ffa96..31b4c76c7f 100644 --- a/src/status_im/contact/block.cljs +++ b/src/status_im/contact/block.cljs @@ -5,6 +5,8 @@ [status-im.data-store.chats :as chats-store] [status-im.data-store.contacts :as contacts-store] [status-im.navigation :as navigation] + [status-im.utils.types :as types] + [status-im.notifications-center.core :as notification-center] [status-im.utils.fx :as fx])) (fx/defn clean-up-chat @@ -34,13 +36,16 @@ (fx/defn contact-blocked {:events [::contact-blocked]} [{:keys [db] :as cofx} {:keys [public-key]} chats] - (let [fxs (map #(clean-up-chat public-key %) chats)] + (let [fxs (when chats + (map #(->> (chats-store/<-rpc %) + (clean-up-chat public-key)) (types/js->clj chats)))] (apply fx/merge cofx {:db (-> db (update :chats dissoc public-key) (update :chats-home-list disj public-key) (assoc-in [:contacts/contacts public-key :added] false))} + (notification-center/get-activity-center-notifications-count) fxs))) (fx/defn block-contact @@ -58,8 +63,10 @@ (update :contacts/blocked (fnil conj #{}) public-key) ;; update the contact in contacts list (assoc-in [:contacts/contacts public-key] contact))} - (contacts-store/block public-key #(do (re-frame/dispatch [::contact-blocked contact (map chats-store/<-rpc %)]) - (re-frame/dispatch [:hide-popover]))) + (contacts-store/block + public-key #(do (re-frame/dispatch [::contact-blocked contact (.-chats %)]) + (re-frame/dispatch [:sanitize-messages-and-process-response %]) + (re-frame/dispatch [:hide-popover]))) ;; reset navigation to avoid going back to non existing one to one chat (if from-one-to-one-chat? (navigation/pop-to-root-tab :chat-stack) diff --git a/src/status_im/data_store/contacts.cljs b/src/status_im/data_store/contacts.cljs index 96079116ff..9b899e2797 100644 --- a/src/status_im/data_store/contacts.cljs +++ b/src/status_im/data_store/contacts.cljs @@ -45,6 +45,7 @@ (fx/defn block [_ contact-id on-success] {::json-rpc/call [{:method (json-rpc/call-ext-method "blockContact") :params [contact-id] + :js-response true :on-success on-success :on-failure #(log/error "failed to block contact" % contact-id)}]}) diff --git a/src/status_im/transport/message/core.cljs b/src/status_im/transport/message/core.cljs index 5dca96ee9d..0896dfea40 100644 --- a/src/status_im/transport/message/core.cljs +++ b/src/status_im/transport/message/core.cljs @@ -81,9 +81,7 @@ (fx/merge cofx (process-next response-js sync-handler) (models.contact/ensure-contacts - (map data-store.contacts/<-rpc contacts-clj) - (when chats - (map data-store.chats/<-rpc (types/js->clj chats)))))) + (map data-store.contacts/<-rpc contacts-clj) chats))) (seq communities) (let [communities-clj (types/js->clj communities)] diff --git a/status-go-version.json b/status-go-version.json index f7c5c8116a..4fe1abdf2a 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,7 +3,7 @@ "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v0.91.15", - "commit-sha1": "258cbb694f040007d3b360638c9390885dcad8ff", - "src-sha256": "1rc6pq8js477cxxph25ahzyyga9ygf7cr1gwmayfa9z89mhjqcva" + "version": "v0.92.0", + "commit-sha1": "83c384989967131afcb47d7f4df673725adf6a71", + "src-sha256": "0djagpalbpi4zi54raa28m8vnp0gajpm8fb76wm4mc5rz8542an3" }