diff options
author | Cheng-Han, Wu | 2016-01-20 23:20:50 -0600 |
---|---|---|
committer | Cheng-Han, Wu | 2016-01-20 23:20:50 -0600 |
commit | 16dcd27b780fe47ceffa43678ae0aec3fbf735c7 (patch) | |
tree | 5f6ba161f3c04343dd33f6b59389ea665a2c7575 /lib/note.js | |
parent | 50805f35408aa5bf28659bb403d1d3456286708f (diff) |
Fixed potential bug in realtime startConnection and bugs in note findOrNewNote, response showNote
Diffstat (limited to '')
-rw-r--r-- | lib/note.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/note.js b/lib/note.js index cd3816f9..a73d2d1d 100644 --- a/lib/note.js +++ b/lib/note.js @@ -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) { |