You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2026-05-22 09:05:38 +02:00
Various changes
This commit is contained in:
@@ -166,6 +166,11 @@ class FileApiDriverOneDrive {
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
// delta(path) {
|
||||
// let response = await this.api_.exec('GET', this.makePath_(path) + ':/delta');
|
||||
// console.info(response);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
export { FileApiDriverOneDrive };
|
||||
@@ -109,12 +109,22 @@ class BaseItem extends BaseModel {
|
||||
let trackDeleted = true;
|
||||
if (options && options.trackDeleted !== null && options.trackDeleted !== undefined) trackDeleted = options.trackDeleted;
|
||||
|
||||
// Don't create a deleted_items entry when conflicted notes are deleted
|
||||
// since no other client have (or should have) them.
|
||||
let conflictNoteIds = [];
|
||||
if (this.modelType() == BaseModel.TYPE_NOTE) {
|
||||
const conflictNotes = await this.db().selectAll('SELECT id FROM notes WHERE id IN ("' + ids.join('","') + '") AND is_conflict = 1');
|
||||
conflictNoteIds = conflictNotes.map((n) => { return n.id });
|
||||
}
|
||||
|
||||
await super.batchDelete(ids, options);
|
||||
|
||||
if (trackDeleted) {
|
||||
let queries = [];
|
||||
let now = time.unixMs();
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
if (conflictNoteIds.indexOf(ids[i]) >= 0) continue;
|
||||
|
||||
queries.push({
|
||||
sql: 'INSERT INTO deleted_items (item_type, item_id, deleted_time) VALUES (?, ?, ?)',
|
||||
params: [this.modelType(), ids[i], now],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BaseModel } from 'lib/base-model.js';
|
||||
import { Log } from 'lib/log.js';
|
||||
import { sprintf } from 'sprintf-js';
|
||||
import { Folder } from 'lib/models/folder.js';
|
||||
import { BaseItem } from 'lib/models/base-item.js';
|
||||
import { Setting } from 'lib/models/setting.js';
|
||||
@@ -40,6 +41,12 @@ class Note extends BaseItem {
|
||||
return super.serialize(note, 'note', fieldNames);
|
||||
}
|
||||
|
||||
static geolocationUrl(note) {
|
||||
if (!('latitude' in note) || !('longitude' in note)) throw new Error('Latitude or longitude missing');
|
||||
if (!note.latitude && !note.longitude) throw new Error(_('This note does not have geolocation information.'));
|
||||
return sprintf('https://www.openstreetmap.org/?lat=%s&lon=%s&zoom=20', note.latitude, note.longitude)
|
||||
}
|
||||
|
||||
static modelType() {
|
||||
return BaseModel.TYPE_NOTE;
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ Setting.defaults_ = {
|
||||
'sync.target': { value: 'onedrive', type: 'string', public: true },
|
||||
'editor': { value: '', type: 'string', public: true },
|
||||
'locale': { value: 'en_GB', type: 'string', public: true },
|
||||
'aliases': { value: '', type: 'string', public: true },
|
||||
};
|
||||
|
||||
// Contains constants that are set by the application and
|
||||
|
||||
Reference in New Issue
Block a user