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)
|
self.id = try container.decode(String.self, forKey: .id)
|
||||||
if let kind = try? container.decode(Kind.self, forKey: .kind) {
|
if let kind = try? container.decode(Kind.self, forKey: .kind) {
|
||||||
self.kind = 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 {
|
} else {
|
||||||
self.kind = .unknown
|
self.kind = .unknown
|
||||||
}
|
}
|
||||||
|
@ -57,6 +53,7 @@ extension Notification {
|
||||||
case followRequest = "follow_request"
|
case followRequest = "follow_request"
|
||||||
case poll
|
case poll
|
||||||
case update
|
case update
|
||||||
|
case status
|
||||||
case unknown
|
case unknown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,10 @@ public struct NotificationGroup: Identifiable, Hashable {
|
||||||
self.notifications = notifications
|
self.notifications = notifications
|
||||||
self.id = notifications.first!.id
|
self.id = notifications.first!.id
|
||||||
self.kind = notifications.first!.kind
|
self.kind = notifications.first!.kind
|
||||||
if kind == .mention {
|
switch kind {
|
||||||
|
case .mention, .status:
|
||||||
self.statusState = .unknown
|
self.statusState = .unknown
|
||||||
} else {
|
default:
|
||||||
self.statusState = nil
|
self.statusState = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,9 @@ class NotificationsPageViewController: SegmentedPageViewController<Notifications
|
||||||
var allowedTypes: [Pachyderm.Notification.Kind] {
|
var allowedTypes: [Pachyderm.Notification.Kind] {
|
||||||
switch self {
|
switch self {
|
||||||
case .all:
|
case .all:
|
||||||
return Pachyderm.Notification.Kind.allCases
|
var set = Set(Pachyderm.Notification.Kind.allCases)
|
||||||
|
set.remove(.unknown)
|
||||||
|
return Array(set)
|
||||||
case .mentions:
|
case .mentions:
|
||||||
return [.mention]
|
return [.mention]
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
let group = item.group!
|
let group = item.group!
|
||||||
|
|
||||||
switch group.kind {
|
switch group.kind {
|
||||||
case .mention:
|
case .mention, .status:
|
||||||
guard let notification = group.notifications.first,
|
guard let notification = group.notifications.first,
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: statusCell, for: indexPath) as? TimelineStatusTableViewCell else {
|
let cell = tableView.dequeueReusableCell(withIdentifier: statusCell, for: indexPath) as? TimelineStatusTableViewCell else {
|
||||||
fatalError()
|
fatalError()
|
||||||
|
@ -119,7 +119,7 @@ class NotificationsTableViewController: DiffableTimelineLikeTableViewController<
|
||||||
"account": notification.account.id,
|
"account": notification.account.id,
|
||||||
]
|
]
|
||||||
SentrySDK.addBreadcrumb(crumb: crumb)
|
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!)
|
cell.updateUI(statusID: status.id, state: group.statusState!)
|
||||||
return cell
|
return cell
|
||||||
|
|
Loading…
Reference in New Issue