From 9147b3061a9ecd139a9dc03cc631689504f7fc92 Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 1 Aug 2020 18:17:40 +0100 Subject: [PATCH] Desktop: Hide completed to-dos in GotoAnything (#3580) --- ElectronClient/plugins/GotoAnything.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ElectronClient/plugins/GotoAnything.jsx b/ElectronClient/plugins/GotoAnything.jsx index f37dfb0348..9290ab680f 100644 --- a/ElectronClient/plugins/GotoAnything.jsx +++ b/ElectronClient/plugins/GotoAnything.jsx @@ -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, }; };