Fixed potential bug in realtime startConnection and bugs in note findOrNewNote, response showNote
This commit is contained in:
@@ -148,10 +148,10 @@ function newNote(id, owner, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
function findOrNewNote(id, permission, callback) {
|
||||
function findOrNewNote(id, owner, callback) {
|
||||
findNote(id, function (err, note) {
|
||||
if (err || !note) {
|
||||
newNote(id, permission, function (err, note) {
|
||||
newNote(id, owner, function (err, note) {
|
||||
if (err) {
|
||||
logger.error('find or new note failed: ' + err);
|
||||
callback(err, null);
|
||||
@@ -161,6 +161,10 @@ function findOrNewNote(id, permission, callback) {
|
||||
});
|
||||
} else {
|
||||
if (!note.permission) {
|
||||
var permission = "freely";
|
||||
if (owner && owner != "null") {
|
||||
permission = "editable";
|
||||
}
|
||||
note.permission = permission;
|
||||
note.updated = Date.now();
|
||||
note.save(function (err) {
|
||||
|
||||
Reference in New Issue
Block a user