You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2026-05-22 09:05:38 +02:00
Sync when changing note or folder
This commit is contained in:
@@ -43,6 +43,13 @@ class Setting extends BaseModel {
|
||||
this.cache_ = [];
|
||||
return this.modelSelectAll('SELECT * FROM settings').then((rows) => {
|
||||
this.cache_ = rows;
|
||||
|
||||
// TEMPORARY TO CONVERT ALL CLIENT SETTINGS
|
||||
for (let i = 0; i < this.cache_.length; i++) {
|
||||
if (this.cache_[i].key == 'sync.target' && this.cache_[i].value == 'onedrive') {
|
||||
this.cache_[i].value = 3;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -223,7 +230,7 @@ Setting.metadata_ = {
|
||||
'activeFolderId': { value: '', type: 'string', public: false },
|
||||
'sync.2.path': { value: '', type: 'string', public: true, appTypes: ['cli'] },
|
||||
'sync.3.auth': { value: '', type: 'string', public: false },
|
||||
'sync.target': { value: 'onedrive', type: 'enum', public: true, label: () => _('Synchronisation target'), options: () => {
|
||||
'sync.target': { value: Setting.SYNC_TARGET_ONEDRIVE, type: 'enum', public: true, label: () => _('Synchronisation target'), options: () => {
|
||||
let output = {};
|
||||
output[Setting.SYNC_TARGET_MEMORY] = 'Memory';
|
||||
output[Setting.SYNC_TARGET_FILESYSTEM] = _('File system');
|
||||
|
||||
@@ -106,7 +106,7 @@ reg.scheduleSync = async (delay = null) => {
|
||||
|
||||
reg.logger().info('Scheduling sync operation...');
|
||||
|
||||
reg.scheduleSyncId_ = setTimeout(async () => {
|
||||
const timeoutCallback = async () => {
|
||||
reg.scheduleSyncId_ = null;
|
||||
reg.logger().info('Doing scheduled sync');
|
||||
|
||||
@@ -129,7 +129,13 @@ reg.scheduleSync = async (delay = null) => {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}, delay);
|
||||
};
|
||||
|
||||
if (delay === 0) {
|
||||
timeoutCallback();
|
||||
} else {
|
||||
reg.scheduleSyncId_ = setTimeout(timeoutCallback, delay);
|
||||
}
|
||||
}
|
||||
|
||||
reg.setDb = (v) => {
|
||||
|
||||
Reference in New Issue
Block a user