From c3cf38b0c90aec227ffc6ea65a11781a31326aff Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 26 Jun 2023 21:17:21 -0700 Subject: [PATCH] Fix not being able to refresh Mentions tab on Pleroma Closes #411 --- .../Sources/InstanceFeatures/InstanceFeatures.swift | 10 ++++++++++ .../NotificationsCollectionViewController.swift | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/Packages/InstanceFeatures/Sources/InstanceFeatures/InstanceFeatures.swift b/Packages/InstanceFeatures/Sources/InstanceFeatures/InstanceFeatures.swift index 76a2a1ae..fddd0d03 100644 --- a/Packages/InstanceFeatures/Sources/InstanceFeatures/InstanceFeatures.swift +++ b/Packages/InstanceFeatures/Sources/InstanceFeatures/InstanceFeatures.swift @@ -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 { instanceType.isPleroma(.akkoma(nil)) } diff --git a/Tusker/Screens/Notifications/NotificationsCollectionViewController.swift b/Tusker/Screens/Notifications/NotificationsCollectionViewController.swift index b5c77334..8df022f7 100644 --- a/Tusker/Screens/Notifications/NotificationsCollectionViewController.swift +++ b/Tusker/Screens/Notifications/NotificationsCollectionViewController.swift @@ -398,6 +398,12 @@ extension NotificationsCollectionViewController { var types = Set(Notification.Kind.allCases) types.remove(.unknown) 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) } }