Fix all profile statuses appearing as pinned on PixelFed

This commit is contained in:
Shadowfacts 2022-04-01 18:51:56 -04:00
parent cab78a4aa4
commit 7e90fe2401
3 changed files with 11 additions and 2 deletions

View File

@ -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 {

View File

@ -105,7 +105,8 @@ class ProfileStatusesViewController: DiffableTimelineLikeTableViewController<Pro
}
private func loadPinnedStatuses(snapshot: @escaping () -> Snapshot, completion: @escaping (LoadResult) -> Void) {
guard kind == .statuses else {
guard kind == .statuses,
mastodonController.instanceFeatures.profilePinnedStatuses else {
completion(.success(snapshot()))
return
}

View File

@ -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 }