forked from shadowfacts/Tusker
Fix crash when requests race with own account
If the notifications/etc load first, and the table view cells are created, mastodonController.account may still be nil
This commit is contained in:
parent
99a1c76cb1
commit
ce7ce3ac92
|
@ -95,7 +95,7 @@ class StatusPollView: UIView {
|
||||||
guard let poll = poll else { return }
|
guard let poll = poll else { return }
|
||||||
|
|
||||||
// poll.voted is nil if there is no user (e.g., public timeline), in which case the poll also cannot be voted upon
|
// poll.voted is nil if there is no user (e.g., public timeline), in which case the poll also cannot be voted upon
|
||||||
if (poll.voted ?? true) || poll.expired || status.account.id == mastodonController.account.id {
|
if (poll.voted ?? true) || poll.expired || status.account.id == mastodonController.account?.id {
|
||||||
canVote = false
|
canVote = false
|
||||||
} else {
|
} else {
|
||||||
canVote = true
|
canVote = true
|
||||||
|
@ -126,7 +126,7 @@ class StatusPollView: UIView {
|
||||||
if expired {
|
if expired {
|
||||||
voteButton.disabledTitle = "Expired"
|
voteButton.disabledTitle = "Expired"
|
||||||
} else if poll.voted ?? false {
|
} else if poll.voted ?? false {
|
||||||
if status.account.id == mastodonController.account.id {
|
if status.account.id == mastodonController.account?.id {
|
||||||
voteButton.isHidden = true
|
voteButton.isHidden = true
|
||||||
} else {
|
} else {
|
||||||
voteButton.disabledTitle = "Voted"
|
voteButton.disabledTitle = "Voted"
|
||||||
|
|
|
@ -170,7 +170,7 @@ class BaseStatusTableViewCell: UITableViewCell {
|
||||||
let reblogDisabled: Bool
|
let reblogDisabled: Bool
|
||||||
if mastodonController.instanceFeatures.boostToOriginalAudience {
|
if mastodonController.instanceFeatures.boostToOriginalAudience {
|
||||||
// Pleroma allows 'Boost to original audience' for your own private posts
|
// Pleroma allows 'Boost to original audience' for your own private posts
|
||||||
reblogDisabled = status.visibility == .direct || (status.visibility == .private && status.account.id != mastodonController.account.id)
|
reblogDisabled = status.visibility == .direct || (status.visibility == .private && status.account.id != mastodonController.account?.id)
|
||||||
} else {
|
} else {
|
||||||
reblogDisabled = status.visibility == .private || status.visibility == .direct
|
reblogDisabled = status.visibility == .private || status.visibility == .direct
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ extension StatusCollectionViewCell {
|
||||||
}
|
}
|
||||||
if status.visibility == .direct || status.visibility == .private {
|
if status.visibility == .direct || status.visibility == .private {
|
||||||
if mastodonController.instanceFeatures.boostToOriginalAudience,
|
if mastodonController.instanceFeatures.boostToOriginalAudience,
|
||||||
status.account.id == mastodonController.account.id {
|
status.account.id == mastodonController.account?.id {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue