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 instanceType == .pleroma
} }
var profilePinnedStatuses: Bool {
instanceType != .pixelfed
}
mutating func update(instance: Instance, nodeInfo: NodeInfo?) { mutating func update(instance: Instance, nodeInfo: NodeInfo?) {
let ver = instance.version.lowercased() let ver = instance.version.lowercased()
if ver.contains("glitch") { if ver.contains("glitch") {
@ -37,6 +41,8 @@ struct InstanceFeatures {
instanceType = .hometown instanceType = .hometown
} else if ver.contains("pleroma") { } else if ver.contains("pleroma") {
instanceType = .pleroma instanceType = .pleroma
} else if ver.contains("pixelfed") {
instanceType = .pixelfed
} else { } else {
instanceType = .mastodon instanceType = .mastodon
} }
@ -51,6 +57,7 @@ extension InstanceFeatures {
case pleroma case pleroma
case hometown case hometown
case glitch case glitch
case pixelfed
var isMastodon: Bool { var isMastodon: Bool {
switch self { switch self {

View File

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

View File

@ -163,7 +163,8 @@ extension MenuPreviewProvider {
} }
// only allowing pinning user's own statuses // 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 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 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 } guard let self = self else { return }