Fix crash when loading older/newer notifications on Pixelfed
Damn Pixelfed returning nonsensical pagination links Closes #166
This commit is contained in:
parent
facf039f97
commit
92efee6f46
|
@ -107,11 +107,13 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
|||
case let .failure(error):
|
||||
completion(.failure(.client(error)))
|
||||
|
||||
case let .success(notifications, pagination):
|
||||
case let .success(notifications, _):
|
||||
let groups = NotificationGroup.createGroups(notifications: notifications, only: self.groupTypes)
|
||||
|
||||
self.newer = pagination?.newer
|
||||
self.older = pagination?.older
|
||||
if !notifications.isEmpty {
|
||||
self.newer = .after(id: notifications.first!.id, count: nil)
|
||||
self.older = .before(id: notifications.last!.id, count: nil)
|
||||
}
|
||||
|
||||
self.mastodonController.persistentContainer.addAll(notifications: notifications) {
|
||||
var snapshot = Snapshot()
|
||||
|
@ -135,9 +137,9 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
|||
case let .failure(error):
|
||||
completion(.failure(.client(error)))
|
||||
|
||||
case let .success(newNotifications, pagination):
|
||||
if let older = pagination?.older {
|
||||
self.older = older
|
||||
case let .success(newNotifications, _):
|
||||
if !newNotifications.isEmpty {
|
||||
self.older = .before(id: newNotifications.last!.id, count: nil)
|
||||
}
|
||||
|
||||
let olderGroups = NotificationGroup.createGroups(notifications: newNotifications, only: self.groupTypes)
|
||||
|
@ -166,15 +168,13 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
|||
case let .failure(error):
|
||||
completion(.failure(.client(error)))
|
||||
|
||||
case let .success(newNotifications, pagination):
|
||||
case let .success(newNotifications, _):
|
||||
guard !newNotifications.isEmpty else {
|
||||
completion(.failure(.allCaughtUp))
|
||||
return
|
||||
}
|
||||
|
||||
if let newer = pagination?.newer {
|
||||
self.newer = newer
|
||||
}
|
||||
self.newer = .after(id: newNotifications.first!.id, count: nil)
|
||||
|
||||
let newerGroups = NotificationGroup.createGroups(notifications: newNotifications, only: self.groupTypes)
|
||||
|
||||
|
|
Loading…
Reference in New Issue