Fix not being able to refresh Mentions tab on Pleroma

Closes #411
This commit is contained in:
Shadowfacts 2023-06-26 21:17:21 -07:00
parent 7929e7530f
commit c3cf38b0c9
2 changed files with 16 additions and 0 deletions

View File

@ -134,6 +134,16 @@ public class InstanceFeatures: ObservableObject {
} }
} }
public var statusEditNotifications: Bool {
// pleroma doesn't seem to support 'update' type notifications, even though it supports edits
hasMastodonVersion(3, 5, 0)
}
public var statusNotifications: Bool {
// pleroma doesn't support notifications for new posts from an account
hasMastodonVersion(3, 3, 0)
}
public var needsEditAttachmentsInSeparateRequest: Bool { public var needsEditAttachmentsInSeparateRequest: Bool {
instanceType.isPleroma(.akkoma(nil)) instanceType.isPleroma(.akkoma(nil))
} }

View File

@ -398,6 +398,12 @@ extension NotificationsCollectionViewController {
var types = Set(Notification.Kind.allCases) var types = Set(Notification.Kind.allCases)
types.remove(.unknown) types.remove(.unknown)
allowedTypes.forEach { types.remove($0) } allowedTypes.forEach { types.remove($0) }
if !mastodonController.instanceFeatures.statusEditNotifications {
types.remove(.update)
}
if !mastodonController.instanceFeatures.statusNotifications {
types.remove(.status)
}
return Client.getNotifications(excludedTypes: Array(types), range: range) return Client.getNotifications(excludedTypes: Array(types), range: range)
} }
} }