Decline pending group invites from user, when user is blocked (#12878)

This commit is contained in:
Parvesh Monu 2021-12-06 18:34:13 +05:30 committed by GitHub
parent 32c0f9719c
commit 11d3bf094a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 9 deletions

View File

@ -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)

View File

@ -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)}]})

View File

@ -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)]

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"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"
}