From 47f170138828a5be59979b22f3a919e49e796432 Mon Sep 17 00:00:00 2001
From: Bruno Muniz Azevedo Filho <bruno@elixxir.io>
Date: Fri, 24 Jun 2022 13:27:11 -0300
Subject: [PATCH] Filtering myself from create group contact list and securing
 optional on request popup

---
 .../ContactListFeature/ViewModels/CreateGroupViewModel.swift    | 1 +
 Sources/SearchFeature/Controllers/SearchController.swift        | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Sources/ContactListFeature/ViewModels/CreateGroupViewModel.swift b/Sources/ContactListFeature/ViewModels/CreateGroupViewModel.swift
index 70485e37..67e70645 100644
--- a/Sources/ContactListFeature/ViewModels/CreateGroupViewModel.swift
+++ b/Sources/ContactListFeature/ViewModels/CreateGroupViewModel.swift
@@ -44,6 +44,7 @@ final class CreateGroupViewModel {
     init() {
         session.dbManager.fetchContactsPublisher(.init(authStatus: [.friend]))
             .assertNoFailure()
+            .map { $0.filter { $0.id != self.session.myId }}
             .map { $0.sorted(by: { $0.username! < $1.username! })}
             .sink { [unowned self] in
                 allContacts = $0
diff --git a/Sources/SearchFeature/Controllers/SearchController.swift b/Sources/SearchFeature/Controllers/SearchController.swift
index 7f425076..795c6000 100644
--- a/Sources/SearchFeature/Controllers/SearchController.swift
+++ b/Sources/SearchFeature/Controllers/SearchController.swift
@@ -258,7 +258,7 @@ extension SearchController {
             spacingAfter: 20
         )
 
-        var subtitleFragment = "Share your information with #\(contact.username)"
+        var subtitleFragment = "Share your information with #\(contact.username ?? "")"
 
         if let email = contact.email {
             subtitleFragment.append(contentsOf: " (\(email))#")
-- 
GitLab