summaryrefslogtreecommitdiff
path: root/lib/note.js
diff options
context:
space:
mode:
authorWu Cheng-Han2016-01-12 08:01:42 -0600
committerWu Cheng-Han2016-01-12 08:01:42 -0600
commit2ecec3b59aabe2fd6156338cd4cbab7672d4f9b1 (patch)
treea27846db2e2e8d0ef1480893a8ad2b69dac36ad0 /lib/note.js
parent1672df3dceebe885ded02530799a78d5a07be1d7 (diff)
Support show last change user with profile and support YAML config inside the note with robots, lang, dir, breaks options
Diffstat (limited to '')
-rw-r--r--lib/note.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/note.js b/lib/note.js
index dc384b7f..671e5383 100644
--- a/lib/note.js
+++ b/lib/note.js
@@ -26,6 +26,10 @@ var model = mongoose.model('note', {
type: String,
enum: permissionTypes
},
+ lastchangeuser: {
+ type: Schema.Types.ObjectId,
+ ref: 'user'
+ },
viewcount: {
type: Number,
default: 0
@@ -45,7 +49,8 @@ var note = {
getNoteTitle: getNoteTitle,
generateWebTitle: generateWebTitle,
increaseViewCount: increaseViewCount,
- updatePermission: updatePermission
+ updatePermission: updatePermission,
+ updateLastChangeUser: updateLastChangeUser
};
function checkNoteIdValid(noteId) {
@@ -198,4 +203,18 @@ function updatePermission(note, permission, callback) {
});
}
+function updateLastChangeUser(note, lastchangeuser, callback) {
+ note.lastchangeuser = lastchangeuser;
+ note.updated = Date.now();
+ note.save(function (err) {
+ if (err) {
+ logger.error('update note lastchangeuser failed: ' + err);
+ callback(err, null);
+ } else {
+ logger.info("update note lastchangeuser success: " + note.id);
+ callback(null, note);
+ };
+ });
+}
+
module.exports = note; \ No newline at end of file