Always provide the attribute \'modified\' when creating or modifying a note to allow the API to handle conflicts

This commit is contained in:
Scharel Clemens 2020-01-04 14:53:50 +01:00
parent 52132195a5
commit f7bc0ed9b8
3 changed files with 4 additions and 4 deletions

View file

@ -16,7 +16,7 @@ Dialog {
property string errorMessage
onAccepted: {
notesApi.updateNote(id, { 'category': categoryField.text, 'content': contentArea.text, 'favorite': favoriteButton.selected } )
notesApi.updateNote(id, { 'category': categoryField.text, 'content': contentArea.text, 'favorite': favoriteButton.selected, 'modified': new Date().valueOf() / 1000 } )
}
function reloadContent() {

View file

@ -119,8 +119,8 @@ Dialog {
MenuLabel {
visible: appSettings.currentAccount.length >= 0
text: qsTr("Last update") + ": " + (
new Date(notesApi.update).valueOf() !== 0 ?
new Date(notesApi.update).toLocaleString(Qt.locale(), Locale.ShortFormat) :
new Date(account.update).valueOf() !== 0 ?
new Date(account.update).toLocaleString(Qt.locale(), Locale.ShortFormat) :
qsTr("never"))
}
}

View file

@ -50,7 +50,7 @@ Page {
MenuItem {
text: qsTr("Add note")
enabled: appSettings.currentAccount.length > 0
onClicked: notesApi.createNote( { 'content': "" } )
onClicked: notesApi.createNote( { 'content': "", 'modified': new Date().valueOf() / 1000 } )
}
MenuItem {
text: enabled ? qsTr("Reload") : qsTr("Updating...")