From e0d97cd2a8b2e6950a4552461575456ef630b184 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 18 Dec 2022 11:32:08 -0500 Subject: [PATCH] Fix unknown notifications appearing in the Mentions tab --- Packages/Pachyderm/Sources/Pachyderm/Client.swift | 4 ++-- .../NotificationsTableViewController.swift | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Packages/Pachyderm/Sources/Pachyderm/Client.swift b/Packages/Pachyderm/Sources/Pachyderm/Client.swift index c38755e1..dcebb6e8 100644 --- a/Packages/Pachyderm/Sources/Pachyderm/Client.swift +++ b/Packages/Pachyderm/Sources/Pachyderm/Client.swift @@ -298,9 +298,9 @@ public class Client { } // MARK: - Notifications - public static func getNotifications(excludeTypes: [Notification.Kind], range: RequestRange = .default) -> Request<[Notification]> { + public static func getNotifications(allowedTypes: [Notification.Kind], range: RequestRange = .default) -> Request<[Notification]> { var request = Request<[Notification]>(method: .get, path: "/api/v1/notifications", queryParameters: - "exclude_types" => excludeTypes.map { $0.rawValue } + "types" => allowedTypes.map { $0.rawValue } ) request.range = range return request diff --git a/Tusker/Screens/Notifications/NotificationsTableViewController.swift b/Tusker/Screens/Notifications/NotificationsTableViewController.swift index f39364b1..5192bd9f 100644 --- a/Tusker/Screens/Notifications/NotificationsTableViewController.swift +++ b/Tusker/Screens/Notifications/NotificationsTableViewController.swift @@ -22,14 +22,14 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController< weak var mastodonController: MastodonController! - private let excludedTypes: [Pachyderm.Notification.Kind] + private let allowedTypes: [Pachyderm.Notification.Kind] private let groupTypes = [Pachyderm.Notification.Kind.favourite, .reblog, .follow] private var newer: RequestRange? private var older: RequestRange? init(allowedTypes: [Pachyderm.Notification.Kind], mastodonController: MastodonController) { - self.excludedTypes = Array(Set(Pachyderm.Notification.Kind.allCases).subtracting(allowedTypes)) + self.allowedTypes = allowedTypes self.mastodonController = mastodonController super.init() @@ -140,7 +140,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController< } override func loadInitialItems(completion: @escaping (LoadResult) -> Void) { - let request = Client.getNotifications(excludeTypes: excludedTypes) + let request = Client.getNotifications(allowedTypes: allowedTypes) mastodonController.run(request) { (response) in switch response { case let .failure(error): @@ -171,7 +171,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController< return } - let request = Client.getNotifications(excludeTypes: excludedTypes, range: older) + let request = Client.getNotifications(allowedTypes: allowedTypes, range: older) mastodonController.run(request) { (response) in switch response { case let .failure(error): @@ -203,7 +203,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController< return } - let request = Client.getNotifications(excludeTypes: excludedTypes, range: newer) + let request = Client.getNotifications(allowedTypes: allowedTypes, range: newer) mastodonController.run(request) { (response) in switch response { case let .failure(error):