mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-01 18:10:16 +00:00
Clear undo stack on deleting an account.
This commit is contained in:
1 parent
2f8eed1efb
commit
8e63a8cd54
2 files changed
+10
-1
No files matched your search
@@ -241,7 +241,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(accountDidDownloadArticles(_:)), name: .AccountDidDownloadArticles, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(accountStateDidChange(_:)), name: .AccountStateDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange(_:)), name: .UserDidAddAccount, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(accountsDidChange(_:)), name: .UserDidDeleteAccount, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(userDidDeleteAccount(_:)), name: .UserDidDeleteAccount, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(containerChildrenDidChange(_:)), name: .ChildrenDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(forName: UserDefaults.didChangeNotification, object: nil, queue: .main) { [weak self] _ in
|
||||
Task { @MainActor in
|
||||
@@ -721,6 +721,13 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
}
|
||||
}
|
||||
|
||||
@objc func userDidDeleteAccount(_ note: Notification) {
|
||||
undoManager?.removeAllActions() // Undo stack may contain actions for the deleted account.
|
||||
if representedObjectsContainsAnyPseudoFeed() {
|
||||
fetchAndReplaceArticlesAsync()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func containerChildrenDidChange(_ note: Notification) {
|
||||
if representedObjectsContainsAnyPseudoFeed() || representedObjectsContainAnyFolder() {
|
||||
fetchAndReplaceArticlesAsync()
|
||||
|
||||
@@ -553,6 +553,8 @@ struct SidebarItemNode: Hashable, Sendable {
|
||||
@objc func userDidDeleteAccount(_ note: Notification) {
|
||||
Self.logger.debug("SceneCoordinator: userDidDeleteAccount")
|
||||
|
||||
undoManager?.removeAllActions() // Undo stack may contain actions for the deleted account.
|
||||
|
||||
let cleanupAccount = {
|
||||
if let account = note.userInfo?[Account.UserInfoKey.account] as? Account,
|
||||
let node = self.treeController.rootNode.childNodeRepresentingObject(account) {
|
||||
|
||||
Reference in new issue
Block a user