1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-23 18:53:36 +02:00

Desktop: Hide completed to-dos in GotoAnything (#3580)

This commit is contained in:
Laurent 2020-08-01 18:17:40 +01:00 committed by GitHub
parent 1b0102f62c
commit 9147b3061a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -227,7 +227,7 @@ class Dialog extends React.PureComponent {
} else {
const limit = 20;
const searchKeywords = this.keywords(searchQuery);
const notes = await Note.byIds(results.map(result => result.id).slice(0, limit), { fields: ['id', 'body', 'markup_language'] });
const notes = await Note.byIds(results.map(result => result.id).slice(0, limit), { fields: ['id', 'body', 'markup_language', 'is_todo', 'todo_completed'] });
const notesById = notes.reduce((obj, { id, body, markup_language }) => ((obj[[id]] = { id, body, markup_language }), obj), {});
for (let i = 0; i < results.length; i++) {
@ -269,6 +269,10 @@ class Dialog extends React.PureComponent {
results[i] = Object.assign({}, row, { path: path, fragments: '' });
}
}
if (!this.props.showCompletedTodos) {
results = results.filter((row) => !row.is_todo || !row.todo_completed);
}
}
}
@ -449,6 +453,7 @@ const mapStateToProps = (state) => {
return {
folders: state.folders,
theme: state.settings.theme,
showCompletedTodos: state.settings.showCompletedTodos,
};
};