fix searchForNotes API method to look for archived notes as well

This commit is contained in:
zadam
2021-02-09 22:32:25 +01:00
parent bf231d31a2
commit 43ac712fca
5 changed files with 12 additions and 10 deletions

View File

@@ -92,13 +92,15 @@ function BackendScriptApi(currentNote, apiParams) {
*
* @method
* @param {string} query
* @param {SearchContext} [searchContext]
* @param {Object} [searchParams]
* @returns {Note[]}
*/
this.searchForNotes = (query, searchContext) => {
searchContext = searchContext || new SearchContext();
this.searchForNotes = (query, searchParams = {}) => {
if (searchParams.includeArchivedNotes === undefined) {
searchParams.includeArchivedNotes = true;
}
const noteIds = searchService.findNotesWithQuery(query, searchContext)
const noteIds = searchService.findNotesWithQuery(query, new SearchContext(searchParams))
.map(sr => sr.noteId);
return repository.getNotes(noteIds);