mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Support show last change user with profile and support YAML config inside the note with robots, lang, dir, breaks options
This commit is contained in:
parent
1672df3dce
commit
2ecec3b59a
18 changed files with 546 additions and 167 deletions
21
lib/note.js
21
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;
|
Loading…
Add table
Add a link
Reference in a new issue