From 7e90fe2401b0957c70f5bb2d6ef1bb5a6935921d Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 1 Apr 2022 18:51:56 -0400 Subject: [PATCH] Fix all profile statuses appearing as pinned on PixelFed --- Tusker/InstanceFeatures.swift | 7 +++++++ Tusker/Screens/Profile/ProfileStatusesViewController.swift | 3 ++- Tusker/Screens/Utilities/Previewing.swift | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Tusker/InstanceFeatures.swift b/Tusker/InstanceFeatures.swift index d35b02c3..c365cd22 100644 --- a/Tusker/InstanceFeatures.swift +++ b/Tusker/InstanceFeatures.swift @@ -29,6 +29,10 @@ struct InstanceFeatures { instanceType == .pleroma } + var profilePinnedStatuses: Bool { + instanceType != .pixelfed + } + mutating func update(instance: Instance, nodeInfo: NodeInfo?) { let ver = instance.version.lowercased() if ver.contains("glitch") { @@ -37,6 +41,8 @@ struct InstanceFeatures { instanceType = .hometown } else if ver.contains("pleroma") { instanceType = .pleroma + } else if ver.contains("pixelfed") { + instanceType = .pixelfed } else { instanceType = .mastodon } @@ -51,6 +57,7 @@ extension InstanceFeatures { case pleroma case hometown case glitch + case pixelfed var isMastodon: Bool { switch self { diff --git a/Tusker/Screens/Profile/ProfileStatusesViewController.swift b/Tusker/Screens/Profile/ProfileStatusesViewController.swift index 06032a1a..7f9b26e2 100644 --- a/Tusker/Screens/Profile/ProfileStatusesViewController.swift +++ b/Tusker/Screens/Profile/ProfileStatusesViewController.swift @@ -105,7 +105,8 @@ class ProfileStatusesViewController: DiffableTimelineLikeTableViewController Snapshot, completion: @escaping (LoadResult) -> Void) { - guard kind == .statuses else { + guard kind == .statuses, + mastodonController.instanceFeatures.profilePinnedStatuses else { completion(.success(snapshot())) return } diff --git a/Tusker/Screens/Utilities/Previewing.swift b/Tusker/Screens/Utilities/Previewing.swift index 2483746c..633c14fc 100644 --- a/Tusker/Screens/Utilities/Previewing.swift +++ b/Tusker/Screens/Utilities/Previewing.swift @@ -163,7 +163,8 @@ extension MenuPreviewProvider { } // only allowing pinning user's own statuses - if account.id == status.account.id { + if account.id == status.account.id, + mastodonController.instanceFeatures.profilePinnedStatuses { let pinned = status.pinned ?? false actionsSection.append(createAction(identifier: "pin", title: pinned ? "Unpin from Profile" : "Pin to Profile", systemImageName: pinned ? "pin.slash" : "pin", handler: { [weak self] (_) in guard let self = self else { return }