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/response.js | |
parent | 50805f35408aa5bf28659bb403d1d3456286708f (diff) |
Fixed potential bug in realtime startConnection and bugs in note findOrNewNote, response showNote
Diffstat (limited to 'lib/response.js')
-rw-r--r-- | lib/response.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/response.js b/lib/response.js index e27411c8..e656d550 100644 --- a/lib/response.js +++ b/lib/response.js @@ -175,15 +175,15 @@ function showNote(req, res, next) { return response.errorNotFound(res); } } - Note.findNote(noteId, function (err, note) { - if (err || !note) { + db.readFromDB(noteId, function (err, data) { + if (err) { return response.errorNotFound(res); } - db.readFromDB(note.id, function (err, data) { - if (err) { + var notedata = data.rows[0]; + Note.findOrNewNote(noteId, notedata.owner, function (err, note) { + if (err || !note) { return response.errorNotFound(res); } - var notedata = data.rows[0]; //check view permission if (note.permission == 'private') { if (!req.isAuthenticated() || notedata.owner != req.user._id) |