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() 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 { switch filterResult {
case .allow: case .allow:
setContentViewMode(.status) setContentViewMode(.status)
@ -546,6 +561,10 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
attrStr.append(showStr) attrStr.append(showStr)
filteredLabel.attributedText = attrStr filteredLabel.attributedText = attrStr
setContentViewMode(.filtered) 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 return
case .hide: case .hide:
fatalError("unreachable") fatalError("unreachable")
@ -553,20 +572,11 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
createObservers() createObservers()
self.statusState = state
var hideTimelineReason = true var hideTimelineReason = true
if let rebloggedStatus = status.reblog { if let reblogStatus {
reblogStatusID = statusID
rebloggerID = status.account.id
hideTimelineReason = false hideTimelineReason = false
updateRebloggerLabel(reblogger: status.account) updateRebloggerLabel(reblogger: reblogStatus.account)
status = rebloggedStatus
} else {
reblogStatusID = nil
rebloggerID = nil
} }
if showFollowedHashtags { if showFollowedHashtags {