Note existence check

This commit is contained in:
Mo Bitar
2018-07-11 11:59:48 -05:00
parent 99c6d35ee7
commit 6d3232a25b

View File

@@ -238,6 +238,14 @@ angular.module('app')
this.saveNote = function($event) {
var note = this.note;
note.dummy = false;
// Make sure the note exists. A safety measure, as toggling between tags triggers deletes for dummy notes.
// Race conditions have been fixed, but we'll keep this here just in case.
if(!modelManager.findItem(note.uuid)) {
alert("The note you are attempting to save can not be found or has been deleted. Changes you make will not be synced. Please copy this note's text and start a new note.");
return;
}
this.save()(note, function(success){
if(success) {
if(statusTimeout) $timeout.cancel(statusTimeout);