fix: archived/trashed items getting unselected when changed (#1932)
This commit is contained in:
@@ -393,15 +393,38 @@ export class ItemListController extends AbstractViewController implements Intern
|
|||||||
}
|
}
|
||||||
|
|
||||||
private shouldSelectNextItemOrCreateNewNote = (activeItem: SNNote | FileItem | undefined) => {
|
private shouldSelectNextItemOrCreateNewNote = (activeItem: SNNote | FileItem | undefined) => {
|
||||||
const shouldShowTrashedNotes =
|
const selectedView = this.navigationController.selected
|
||||||
this.navigationController.isInSystemView(SystemViewId.TrashedNotes) || this.searchOptionsController.includeTrashed
|
|
||||||
|
|
||||||
const shouldShowArchivedNotes =
|
const isActiveItemTrashed = activeItem?.trashed
|
||||||
this.navigationController.isInSystemView(SystemViewId.ArchivedNotes) ||
|
const isActiveItemArchived = activeItem?.archived
|
||||||
this.searchOptionsController.includeArchived ||
|
|
||||||
this.application.getPreference(PrefKey.NotesShowArchived, PrefDefaults[PrefKey.NotesShowArchived])
|
|
||||||
|
|
||||||
return (activeItem?.trashed && !shouldShowTrashedNotes) || (activeItem?.archived && !shouldShowArchivedNotes)
|
if (isActiveItemTrashed) {
|
||||||
|
const selectedSmartViewShowsTrashed =
|
||||||
|
selectedView instanceof SmartView && selectedView.predicate.keypathIncludesString('trashed')
|
||||||
|
|
||||||
|
const shouldShowTrashedNotes =
|
||||||
|
this.navigationController.isInSystemView(SystemViewId.TrashedNotes) ||
|
||||||
|
this.searchOptionsController.includeTrashed ||
|
||||||
|
selectedSmartViewShowsTrashed ||
|
||||||
|
this.displayOptions.includeTrashed
|
||||||
|
|
||||||
|
return !shouldShowTrashedNotes
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isActiveItemArchived) {
|
||||||
|
const selectedSmartViewShowsArchived =
|
||||||
|
selectedView instanceof SmartView && selectedView.predicate.keypathIncludesString('archived')
|
||||||
|
|
||||||
|
const shouldShowArchivedNotes =
|
||||||
|
this.navigationController.isInSystemView(SystemViewId.ArchivedNotes) ||
|
||||||
|
this.searchOptionsController.includeArchived ||
|
||||||
|
selectedSmartViewShowsArchived ||
|
||||||
|
this.displayOptions.includeArchived
|
||||||
|
|
||||||
|
return !shouldShowArchivedNotes
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
private shouldSelectActiveItem = (activeItem: SNNote | FileItem | undefined) => {
|
private shouldSelectActiveItem = (activeItem: SNNote | FileItem | undefined) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user