From c107d72954894ef5c445aa39b4cb46ec0a143c23 Mon Sep 17 00:00:00 2001
From: Bruno Muniz Azevedo Filho <bruno@elixxir.io>
Date: Wed, 17 Aug 2022 13:59:33 -0300
Subject: [PATCH] Fix issue where blocked contact group request still shakes
 device

---
 Sources/Integration/Session/Session+Contacts.swift | 1 +
 Sources/Integration/Session/Session.swift          | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/Sources/Integration/Session/Session+Contacts.swift b/Sources/Integration/Session/Session+Contacts.swift
index 7bbe5254..3a462dbe 100644
--- a/Sources/Integration/Session/Session+Contacts.swift
+++ b/Sources/Integration/Session/Session+Contacts.swift
@@ -251,6 +251,7 @@ extension Session {
         contact.photo = nil
         contact.isRecent = false
         contact.marshaled = nil
+        contact.isBlocked = true
         contact.authStatus = .stranger
         contact.nickname = contact.username
         _ = try? dbManager.saveContact(contact)
diff --git a/Sources/Integration/Session/Session.swift b/Sources/Integration/Session/Session.swift
index 1dec54de..317a4bae 100644
--- a/Sources/Integration/Session/Session.swift
+++ b/Sources/Integration/Session/Session.swift
@@ -460,6 +460,12 @@ public final class Session: SessionType {
                     return
                 }
 
+                if let contact = try! dbManager.fetchContacts(.init(id: [request.0.leaderId])).first {
+                    if contact.isBanned || contact.isBlocked {
+                        return
+                    }
+                }
+
                 DispatchQueue.global().async { [weak self] in
                     self?.processGroupCreation(request.0, memberIds: request.1, welcome: request.2)
                 }
-- 
GitLab