From 848022ec6e848b91b216badfe562fce8152bc945 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 16 Jun 2020 22:47:30 -0400 Subject: [PATCH] Disable reblog button for private posts --- Tusker/Views/Status/BaseStatusTableViewCell.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tusker/Views/Status/BaseStatusTableViewCell.swift b/Tusker/Views/Status/BaseStatusTableViewCell.swift index 61e2e0238e..bb50ee2eb7 100644 --- a/Tusker/Views/Status/BaseStatusTableViewCell.swift +++ b/Tusker/Views/Status/BaseStatusTableViewCell.swift @@ -141,6 +141,18 @@ class BaseStatusTableViewCell: UITableViewCell { contentWarningLabel.setEmojis(status.emojis, identifier: statusID) } + let reblogDisabled: Bool + switch mastodonController.instance.instanceType { + case .mastodon: + reblogDisabled = status.visibility == .private || status.visibility == .direct + case .pleroma: + // Pleroma allows 'Boost to original audience' for your own private posts + reblogDisabled = status.visibility == .direct || (status.visibility == .private && status.account.id != mastodonController.account.id) + } + reblogButton.isEnabled = !reblogDisabled + let reblogButtonImage = reblogDisabled ? UIImage(systemName: status.visibility.imageName) : UIImage(systemName: "repeat") + reblogButton.setImage(reblogButtonImage, for: .normal) + if state.unknown { collapsible = !status.spoilerText.isEmpty var shouldCollapse = collapsible