mirror of
https://github.com/laurent22/joplin.git
synced 2025-03-03 15:32:30 +02:00
All: Fixed issue with timestamp when saving notes
This commit is contained in:
parent
c5c6c777be
commit
4d1dd17fa2
@ -254,10 +254,25 @@ class BaseModel {
|
||||
let n = fieldNames[i];
|
||||
if (n in o) temp[n] = o[n];
|
||||
}
|
||||
|
||||
// Remove fields that are not in the `fields` list, if provided.
|
||||
// Note that things like update_time, user_update_time will still
|
||||
// be part of the final list of fields if autoTimestamp is on.
|
||||
// id also will stay.
|
||||
if (!options.isNew && options.fields) {
|
||||
const filtered = {};
|
||||
for (let k in temp) {
|
||||
if (!temp.hasOwnProperty(k)) continue;
|
||||
if (k !== 'id' && options.fields.indexOf(k) < 0) continue;
|
||||
filtered[k] = temp[k];
|
||||
}
|
||||
temp = filtered;
|
||||
}
|
||||
|
||||
o = temp;
|
||||
|
||||
const modelId = temp.id;
|
||||
let query = {};
|
||||
let modelId = o.id;
|
||||
|
||||
const timeNow = time.unixMs();
|
||||
|
||||
@ -296,15 +311,6 @@ class BaseModel {
|
||||
let temp = Object.assign({}, o);
|
||||
delete temp.id;
|
||||
|
||||
if (options.fields) {
|
||||
let filtered = {};
|
||||
for (let i = 0; i < options.fields.length; i++) {
|
||||
const f = options.fields[i];
|
||||
filtered[f] = o[f];
|
||||
}
|
||||
temp = filtered;
|
||||
}
|
||||
|
||||
query = Database.updateQuery(this.tableName(), temp, where);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user