Fix status notifications not being shown
This commit is contained in:
parent
507d9c23e7
commit
125f91257a
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue