1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Desktop: Regression: Fixed handling of provisional status of note

This commit is contained in:
Laurent Cozic
2021-04-07 18:57:44 +02:00
parent fbfca47ef3
commit 5667e687e9
2 changed files with 23 additions and 12 deletions

View File

@@ -502,7 +502,7 @@ export default class Note extends BaseItem {
note.longitude = geoData.coords.longitude;
note.latitude = geoData.coords.latitude;
note.altitude = geoData.coords.altitude;
return Note.save(note);
return Note.save(note, { ignoreProvisionalFlag: true });
}
static filter(note: NoteEntity) {
@@ -626,7 +626,16 @@ export default class Note extends BaseItem {
static async save(o: NoteEntity, options: any = null) {
const isNew = this.isNew(o, options);
// If true, this is a provisional note - it will be saved permanently
// only if the user makes changes to it.
const isProvisional = options && !!options.provisional;
// If true, saving the note will not change the provisional flag of the
// note. This is used for background processing that it not initiated by
// the user. For example when setting the geolocation of a note.
const ignoreProvisionalFlag = options && !!options.ignoreProvisionalFlag;
const dispatchUpdateAction = options ? options.dispatchUpdateAction !== false : true;
if (isNew && !o.source) o.source = Setting.value('appName');
if (isNew && !o.source_application) o.source_application = Setting.value('appId');
@@ -672,6 +681,7 @@ export default class Note extends BaseItem {
type: 'NOTE_UPDATE_ONE',
note: note,
provisional: isProvisional,
ignoreProvisionalFlag: ignoreProvisionalFlag,
changedFields: changedFields,
});
}