From 7b9dc66121464bdf6e71426fdf9c2d4979c23fd3 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 8 Jan 2018 21:25:38 +0100 Subject: [PATCH] All: Schedule sync after enabling or disabling encryption --- ReactNativeClient/lib/BaseApplication.js | 4 ++++ ReactNativeClient/lib/models/Tag.js | 2 +- ReactNativeClient/root.js | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ReactNativeClient/lib/BaseApplication.js b/ReactNativeClient/lib/BaseApplication.js index bf4428795..a6cbead1d 100644 --- a/ReactNativeClient/lib/BaseApplication.js +++ b/ReactNativeClient/lib/BaseApplication.js @@ -277,6 +277,10 @@ class BaseApplication { type: 'MASTERKEY_REMOVE_NOT_LOADED', ids: loadedMasterKeyIds, }); + + // Schedule a sync operation so that items that need to be encrypted + // are sent to sync target. + reg.scheduleSync(); } } diff --git a/ReactNativeClient/lib/models/Tag.js b/ReactNativeClient/lib/models/Tag.js index 806ae302d..1b77d1422 100644 --- a/ReactNativeClient/lib/models/Tag.js +++ b/ReactNativeClient/lib/models/Tag.js @@ -109,7 +109,7 @@ class Tag extends BaseItem { for (let i = 0; i < tagTitles.length; i++) { const title = tagTitles[i].trim().toLowerCase(); if (!title) continue; - let tag = await this.loadByField('title', title); + let tag = await this.loadByField('title', title, { caseInsensitive: true }); if (!tag) tag = await Tag.save({ title: title }, { userSideValidation: true }); await this.addNote(tag.id, noteId); addedTitles.push(title); diff --git a/ReactNativeClient/root.js b/ReactNativeClient/root.js index f588c13ce..16e29341f 100644 --- a/ReactNativeClient/root.js +++ b/ReactNativeClient/root.js @@ -97,6 +97,10 @@ const generalMiddleware = store => next => async (action) => { type: 'MASTERKEY_REMOVE_NOT_LOADED', ids: loadedMasterKeyIds, }); + + // Schedule a sync operation so that items that need to be encrypted + // are sent to sync target. + reg.scheduleSync(); } if (action.type == 'NAV_GO' && action.routeName == 'Notes') {