diff --git a/Tusker/Screens/Explore/ExploreViewController.swift b/Tusker/Screens/Explore/ExploreViewController.swift index 1bd25407..c6064ba8 100644 --- a/Tusker/Screens/Explore/ExploreViewController.swift +++ b/Tusker/Screens/Explore/ExploreViewController.swift @@ -206,6 +206,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect for followed in followed where !saved.contains(where: { $0.name == followed.name }) { items.append(.savedHashtag(Hashtag(name: followed.name, url: followed.url))) } + items = items.uniques() items.sort(using: SemiCaseSensitiveComparator.keyPath(\.label)) return items } @@ -215,7 +216,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect let req = SavedInstance.fetchRequest(account: mastodonController.accountInfo!) req.sortDescriptors = [NSSortDescriptor(key: "url.host", ascending: true)] do { - return try mastodonController.persistentContainer.viewContext.fetch(req) + return try mastodonController.persistentContainer.viewContext.fetch(req).uniques() } catch { return [] } diff --git a/Tusker/Screens/Main/MainSidebarViewController.swift b/Tusker/Screens/Main/MainSidebarViewController.swift index 8ed0a829..dab7647d 100644 --- a/Tusker/Screens/Main/MainSidebarViewController.swift +++ b/Tusker/Screens/Main/MainSidebarViewController.swift @@ -240,6 +240,7 @@ class MainSidebarViewController: UIViewController { for followed in followed where !saved.contains(where: { $0.name == followed.name }) { items.append(.savedHashtag(Hashtag(name: followed.name, url: followed.url))) } + items = items.uniques() items.sort(using: SemiCaseSensitiveComparator.keyPath(\.title)) return items } @@ -249,7 +250,7 @@ class MainSidebarViewController: UIViewController { let req = SavedInstance.fetchRequest(account: mastodonController.accountInfo!) req.sortDescriptors = [NSSortDescriptor(key: "url.host", ascending: true)] do { - return try mastodonController.persistentContainer.viewContext.fetch(req) + return try mastodonController.persistentContainer.viewContext.fetch(req).uniques() } catch { return [] }