From bcae60316b4fcadfe6805e3b401b35c68d30f121 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 1 Apr 2024 11:04:40 -0400 Subject: [PATCH] Fix changing list reply policy not reloading list timeline --- Tusker/Screens/Lists/EditListAccountsViewController.swift | 7 ++++--- Tusker/Screens/Lists/ListTimelineViewController.swift | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Tusker/Screens/Lists/EditListAccountsViewController.swift b/Tusker/Screens/Lists/EditListAccountsViewController.swift index f502b4b2..b3a8ed0c 100644 --- a/Tusker/Screens/Lists/EditListAccountsViewController.swift +++ b/Tusker/Screens/Lists/EditListAccountsViewController.swift @@ -17,7 +17,7 @@ class EditListAccountsViewController: UIViewController, CollectionViewController private var state = State.unloaded - private(set) var changedAccounts = false + private(set) var shouldReloadListTimeline = false private var dataSource: UICollectionViewDiffableDataSource! var collectionView: UICollectionView! { view as? UICollectionView } @@ -278,7 +278,7 @@ class EditListAccountsViewController: UIViewController, CollectionViewController } private func addAccount(id: String) async { - changedAccounts = true + shouldReloadListTimeline = true do { let req = List.add(list.id, accounts: [id]) _ = try await mastodonController.run(req) @@ -294,7 +294,7 @@ class EditListAccountsViewController: UIViewController, CollectionViewController } private func removeAccount(id: String) async { - changedAccounts = true + shouldReloadListTimeline = true do { let request = List.remove(list.id, accounts: [id]) _ = try await mastodonController.run(request) @@ -317,6 +317,7 @@ class EditListAccountsViewController: UIViewController, CollectionViewController } private func setReplyPolicy(_ replyPolicy: List.ReplyPolicy) { + shouldReloadListTimeline = true Task { let service = EditListSettingsService(list: list, mastodonController: mastodonController, present: { self.present($0, animated: true) }) await service.run(replyPolicy: replyPolicy) diff --git a/Tusker/Screens/Lists/ListTimelineViewController.swift b/Tusker/Screens/Lists/ListTimelineViewController.swift index a0db57b7..678f2fc6 100644 --- a/Tusker/Screens/Lists/ListTimelineViewController.swift +++ b/Tusker/Screens/Lists/ListTimelineViewController.swift @@ -101,7 +101,7 @@ class ListTimelineViewController: TimelineViewController { } private func reloadIfNecessary(editViewController: EditListAccountsViewController) { - guard editViewController.changedAccounts else { + guard editViewController.shouldReloadListTimeline else { return } noContentView?.removeFromSuperview()