Fix changing list reply policy not reloading list timeline

This commit is contained in:
Shadowfacts 2024-04-01 11:04:40 -04:00
parent 1a2fa10708
commit bcae60316b
2 changed files with 5 additions and 4 deletions

View File

@ -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<Section, Item>!
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)

View File

@ -101,7 +101,7 @@ class ListTimelineViewController: TimelineViewController {
}
private func reloadIfNecessary(editViewController: EditListAccountsViewController) {
guard editViewController.changedAccounts else {
guard editViewController.shouldReloadListTimeline else {
return
}
noContentView?.removeFromSuperview()