1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Desktop: Resolves #262: Implement "show all notes" (#2472)

* Implement "show all notes" feature.

* Ensure middleware is completely flushed and shutdown before continuing tests.
This commit is contained in:
mic704b
2020-02-22 22:25:16 +11:00
committed by GitHub
parent 0f28060795
commit fbedc6b29b
15 changed files with 344 additions and 16 deletions

View File

@@ -54,6 +54,18 @@ class BaseApplication {
this.decryptionWorker_resourceMetadataButNotBlobDecrypted = this.decryptionWorker_resourceMetadataButNotBlobDecrypted.bind(this);
}
async destroy() {
await FoldersScreenUtils.cancelTimers();
await SearchEngine.instance().cancelTimers();
await DecryptionWorker.instance().cancelTimers();
await reg.cancelTimers();
this.logger_ = null;
this.dbLogger_ = null;
this.eventEmitter_ = null;
this.decryptionWorker_resourceMetadataButNotBlobDecrypted = null;
}
logger() {
return this.logger_;
}
@@ -217,6 +229,9 @@ class BaseApplication {
} else if (parentType === 'Search') {
parentId = state.selectedSearchId;
parentType = BaseModel.TYPE_SEARCH;
} else if (parentType === 'SmartFilter') {
parentId = state.selectedSmartFilterId;
parentType = BaseModel.TYPE_SMART_FILTER;
}
this.logger().debug('Refreshing notes:', parentType, parentId);
@@ -243,6 +258,8 @@ class BaseApplication {
} else if (parentType === BaseModel.TYPE_SEARCH) {
const search = BaseModel.byId(state.searches, parentId);
notes = await SearchEngineUtils.notesForQuery(search.query_pattern);
} else if (parentType === BaseModel.TYPE_SMART_FILTER) {
notes = await Note.previews(parentId, options);
}
}
@@ -435,6 +452,11 @@ class BaseApplication {
refreshNotes = true;
}
if (action.type == 'SMART_FILTER_SELECT') {
refreshNotes = true;
refreshNotesUseSelectedNoteId = true;
}
if (action.type == 'TAG_SELECT' || action.type === 'TAG_DELETE') {
refreshNotes = true;
}
@@ -493,7 +515,6 @@ class BaseApplication {
await FoldersScreenUtils.scheduleRefreshFolders();
}
}
return result;
}
@@ -515,6 +536,16 @@ class BaseApplication {
ResourceFetcher.instance().dispatch = this.store().dispatch;
}
deinitRedux() {
this.store_ = null;
BaseModel.dispatch = function() {};
FoldersScreenUtils.dispatch = function() {};
reg.dispatch = function() {};
BaseSyncTarget.dispatch = function() {};
DecryptionWorker.instance().dispatch = function() {};
ResourceFetcher.instance().dispatch = function() {};
}
async readFlagsFromFile(flagPath) {
if (!fs.existsSync(flagPath)) return {};
let flagContent = fs.readFileSync(flagPath, 'utf8');
@@ -670,7 +701,6 @@ class BaseApplication {
Setting.setValue('activeFolderId', currentFolder ? currentFolder.id : '');
await MigrationService.instance().run();
return argv;
}
}