Fix status notifications not being shown

This commit is contained in:
Shadowfacts 2023-01-24 20:43:43 -05:00
parent 507d9c23e7
commit 125f91257a
4 changed files with 9 additions and 9 deletions

View File

@ -21,10 +21,6 @@ public class Notification: Decodable {
self.id = try container.decode(String.self, forKey: .id)
if let kind = try? container.decode(Kind.self, forKey: .kind) {
self.kind = kind
} else if let s = try? container.decode(String.self, forKey: .kind),
s == "status" {
// represent notifications of other people posting as regular mentions for now
self.kind = .mention
} else {
self.kind = .unknown
}
@ -57,6 +53,7 @@ extension Notification {
case followRequest = "follow_request"
case poll
case update
case status
case unknown
}
}

View File

@ -19,9 +19,10 @@ public struct NotificationGroup: Identifiable, Hashable {
self.notifications = notifications
self.id = notifications.first!.id
self.kind = notifications.first!.kind
if kind == .mention {
switch kind {
case .mention, .status:
self.statusState = .unknown
} else {
default:
self.statusState = nil
}
}

View File

@ -72,7 +72,9 @@ class NotificationsPageViewController: SegmentedPageViewController<Notifications
var allowedTypes: [Pachyderm.Notification.Kind] {
switch self {
case .all:
return Pachyderm.Notification.Kind.allCases
var set = Set(Pachyderm.Notification.Kind.allCases)
set.remove(.unknown)
return Array(set)
case .mentions:
return [.mention]
}

View File

@ -104,7 +104,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
let group = item.group!
switch group.kind {
case .mention:
case .mention, .status:
guard let notification = group.notifications.first,
let cell = tableView.dequeueReusableCell(withIdentifier: statusCell, for: indexPath) as? TimelineStatusTableViewCell else {
fatalError()
@ -119,7 +119,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
"account": notification.account.id,
]
SentrySDK.addBreadcrumb(crumb: crumb)
fatalError("missing status for mention notification")
fatalError("missing status for \(group.kind) notification")
}
cell.updateUI(statusID: status.id, state: group.statusState!)
return cell