From 1bc598691f751402b118e93cc65fa9d9e593377c Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 5 Sep 2019 14:24:13 -0400 Subject: [PATCH] Fix a slew of bugs related to reblogs Fixes #37 Fixes #38 Fixes #39 --- Tusker/Views/Status/StatusTableViewCell.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Tusker/Views/Status/StatusTableViewCell.swift b/Tusker/Views/Status/StatusTableViewCell.swift index c456755fe9..1fc3d6dafa 100644 --- a/Tusker/Views/Status/StatusTableViewCell.swift +++ b/Tusker/Views/Status/StatusTableViewCell.swift @@ -74,7 +74,7 @@ class StatusTableViewCell: UITableViewCell { NotificationCenter.default.addObserver(self, selector: #selector(updateUIForPreferences), name: .preferencesChanged, object: nil) statusUpdater = MastodonCache.statusSubject - .filter { $0.id == self.statusID || $0.id == self.reblogStatusID } + .filter { $0.id == self.statusID } .receive(on: DispatchQueue.main) .sink(receiveValue: updateStatusState(status:)) @@ -96,11 +96,12 @@ class StatusTableViewCell: UITableViewCell { guard var status = MastodonCache.status(for: statusID) else { fatalError("Missing cached status \(statusID)") } self.statusID = statusID - if let reblogID = status.reblog?.id, - let reblog = MastodonCache.status(for: reblogID) { + if let rebloggedStatusID = status.reblog?.id, + let rebloggedStatus = MastodonCache.status(for: rebloggedStatusID) { reblogStatusID = statusID rebloggerID = status.account.id - status = reblog + status = rebloggedStatus + self.statusID = rebloggedStatus.id reblogLabel.isHidden = false } else { reblogStatusID = nil