1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-12 22:57:38 +02:00

All: Fixed handling of unloaded master key

This commit is contained in:
Laurent Cozic
2017-12-22 18:50:27 +00:00
parent 6683da804b
commit 70b03971f6
5 changed files with 16 additions and 16 deletions

View File

@ -9,7 +9,7 @@ const defaultState = {
folders: [],
tags: [],
masterKeys: [],
missingMasterKeys: [],
notLoadedMasterKeys: [],
searches: [],
selectedNoteIds: [],
selectedFolderId: null,
@ -370,27 +370,27 @@ const reducer = (state = defaultState, action) => {
newState.masterKeys = action.items;
break;
case 'MASTERKEY_ADD_MISSING':
case 'MASTERKEY_ADD_NOT_LOADED':
if (state.missingMasterKeys.indexOf(action.id) < 0) {
if (state.notLoadedMasterKeys.indexOf(action.id) < 0) {
newState = Object.assign({}, state);
const keys = newState.missingMasterKeys.slice();
const keys = newState.notLoadedMasterKeys.slice();
keys.push(action.id);
newState.missingMasterKeys = keys;
newState.notLoadedMasterKeys = keys;
}
break;
case 'MASTERKEY_REMOVE_MISSING':
case 'MASTERKEY_REMOVE_NOT_LOADED':
const ids = action.id ? [action.id] : action.ids;
for (let i = 0; i < ids.length; i++) {
const id = ids[i];
const index = state.missingMasterKeys.indexOf(id);
const index = state.notLoadedMasterKeys.indexOf(id);
if (index >= 0) {
newState = Object.assign({}, state);
const keys = newState.missingMasterKeys.slice();
const keys = newState.notLoadedMasterKeys.slice();
keys.splice(index, 1);
newState.missingMasterKeys = keys;
newState.notLoadedMasterKeys = keys;
}
}
break;