Disable reblog button for private posts

This commit is contained in:
Shadowfacts 2020-06-16 22:47:30 -04:00
parent 39e847bda8
commit 848022ec6e
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 12 additions and 0 deletions

View File

@ -141,6 +141,18 @@ class BaseStatusTableViewCell: UITableViewCell {
contentWarningLabel.setEmojis(status.emojis, identifier: statusID) 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 { if state.unknown {
collapsible = !status.spoilerText.isEmpty collapsible = !status.spoilerText.isEmpty
var shouldCollapse = collapsible var shouldCollapse = collapsible