Fix unknown notifications appearing in the Mentions tab
This commit is contained in:
parent
8b718ce50b
commit
e0d97cd2a8
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue