summaryrefslogtreecommitdiff
path: root/lib/note.js
diff options
context:
space:
mode:
authorWu Cheng-Han2016-01-17 09:51:27 -0600
committerWu Cheng-Han2016-01-17 09:51:27 -0600
commit49c7dded4539044d8053dba8d3fe24b97056c0d2 (patch)
tree00fa3f5fd293cc810daa7a2142bc7578de6f422f /lib/note.js
parent473212676ade788b6603a7a3c2bec726c6ca1579 (diff)
Added private permission and clean up codes, solved potential race condition in realtime.js
Diffstat (limited to 'lib/note.js')
-rw-r--r--lib/note.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/note.js b/lib/note.js
index 671e5383..cd3816f9 100644
--- a/lib/note.js
+++ b/lib/note.js
@@ -12,7 +12,7 @@ var db = require("./db.js");
var logger = require("./logger.js");
//permission types
-permissionTypes = ["freely", "editable", "locked"];
+permissionTypes = ["freely", "editable", "locked", "private"];
// create a note model
var model = mongoose.model('note', {
@@ -126,7 +126,11 @@ function findNote(id, callback) {
});
}
-function newNote(id, permission, callback) {
+function newNote(id, owner, callback) {
+ var permission = "freely";
+ if (owner && owner != "null") {
+ permission = "editable";
+ }
var note = new model({
id: id,
permission: permission,