Fix incorrect context menu preview on filtered post

Closes #413
This commit is contained in:
Shadowfacts 2023-06-26 21:12:20 -07:00
parent a11e453112
commit 7929e7530f
1 changed files with 21 additions and 11 deletions

View File

@ -536,6 +536,21 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
fatalError()
}
self.statusState = state
let reblogStatus: StatusMO?
if let rebloggedStatus = status.reblog {
reblogStatus = status
reblogStatusID = statusID
rebloggerID = status.account.id
status = rebloggedStatus
} else {
reblogStatus = nil
reblogStatusID = nil
rebloggerID = nil
}
switch filterResult {
case .allow:
setContentViewMode(.status)
@ -546,6 +561,10 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
attrStr.append(showStr)
filteredLabel.attributedText = attrStr
setContentViewMode(.filtered)
// still update id properties, so that info for other methods (e.g., context menus) is correct
self.statusID = status.id
self.accountID = status.account.id
return
case .hide:
fatalError("unreachable")
@ -553,20 +572,11 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
createObservers()
self.statusState = state
var hideTimelineReason = true
if let rebloggedStatus = status.reblog {
reblogStatusID = statusID
rebloggerID = status.account.id
if let reblogStatus {
hideTimelineReason = false
updateRebloggerLabel(reblogger: status.account)
status = rebloggedStatus
} else {
reblogStatusID = nil
rebloggerID = nil
updateRebloggerLabel(reblogger: reblogStatus.account)
}
if showFollowedHashtags {