Added private permission and clean up codes, solved potential race condition in realtime.js
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user