From 0e2bb5d78433a9df60b202a8a6fd94e8b37ab94d Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 14 May 2019 00:11:27 +0100 Subject: [PATCH] Desktop: Improved: When opening a note using Goto Anything, open all its parent notebooks too --- ElectronClient/app/plugins/GotoAnything.jsx | 14 +++++++++++++- ReactNativeClient/lib/reducer.js | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ElectronClient/app/plugins/GotoAnything.jsx b/ElectronClient/app/plugins/GotoAnything.jsx index 38d04d08a7..de191b22d1 100644 --- a/ElectronClient/app/plugins/GotoAnything.jsx +++ b/ElectronClient/app/plugins/GotoAnything.jsx @@ -193,13 +193,25 @@ class Dialog extends React.PureComponent { } } - gotoItem(item) { + async gotoItem(item) { this.props.dispatch({ pluginName: PLUGIN_NAME, type: 'PLUGIN_DIALOG_SET', open: false, }); + if (this.state.listType === BaseModel.TYPE_NOTE || this.state.listType === BaseModel.TYPE_FOLDER) { + const folderPath = await Folder.folderPath(this.props.folders, item.parent_id); + + for (const folder of folderPath) { + this.props.dispatch({ + type: "FOLDER_SET_COLLAPSED", + id: folder.id, + collapsed: false, + }); + } + } + if (this.state.listType === BaseModel.TYPE_NOTE) { this.props.dispatch({ type: "FOLDER_AND_NOTE_SELECT", diff --git a/ReactNativeClient/lib/reducer.js b/ReactNativeClient/lib/reducer.js index 0c3140ea1c..23a017b6c6 100644 --- a/ReactNativeClient/lib/reducer.js +++ b/ReactNativeClient/lib/reducer.js @@ -488,6 +488,12 @@ const reducer = (state = defaultState, action) => { newState.collapsedFolderIds = action.ids.slice(); break; + case 'FOLDER_SET_COLLAPSED': + + newState = Object.assign({}, state); + folderSetCollapsed(state, action); + break; + case 'TAG_UPDATE_ALL': newState = Object.assign({}, state);