Fix list timelines opened in new window not showing Edit button

This commit is contained in:
Shadowfacts 2023-05-10 11:11:48 -04:00
parent 85765928b4
commit 3394c2126c
1 changed files with 9 additions and 1 deletions

View File

@ -106,7 +106,15 @@ class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate, TuskerSceneDel
private func timelineViewController(for timeline: Timeline, mastodonController: MastodonController) -> UIViewController { private func timelineViewController(for timeline: Timeline, mastodonController: MastodonController) -> UIViewController {
switch timeline { switch timeline {
// todo: list/hashtag controllers need whole objects which must be fetched asynchronously // todo: hashtag controllers need whole objects which must be fetched asynchronously, and that endpoint only exists in mastodon v4
case .list(id: let id):
let req = ListMO.fetchRequest(id: id)
if let list = try? mastodonController.persistentContainer.viewContext.fetch(req).first {
return ListTimelineViewController(for: List(id: id, title: list.title), mastodonController: mastodonController)
} else {
return TimelineViewController(for: timeline, mastodonController: mastodonController)
}
default: default:
return TimelineViewController(for: timeline, mastodonController: mastodonController) return TimelineViewController(for: timeline, mastodonController: mastodonController)
} }