mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 17:56:30 -05:00
Update note model on create doc will use the created time of the doc in filesystem
This commit is contained in:
parent
b9060395ca
commit
03bdee23ff
1 changed files with 2 additions and 0 deletions
|
@ -208,9 +208,11 @@ module.exports = function (sequelize, DataTypes) {
|
||||||
filePath = path.join(config.docspath, note.alias + '.md');
|
filePath = path.join(config.docspath, note.alias + '.md');
|
||||||
}
|
}
|
||||||
if (Note.checkFileExist(filePath)) {
|
if (Note.checkFileExist(filePath)) {
|
||||||
|
var fsCreatedTime = moment(fs.statSync(filePath).ctime);
|
||||||
body = fs.readFileSync(filePath, 'utf8');
|
body = fs.readFileSync(filePath, 'utf8');
|
||||||
note.title = LZString.compressToBase64(Note.parseNoteTitle(body));
|
note.title = LZString.compressToBase64(Note.parseNoteTitle(body));
|
||||||
note.content = LZString.compressToBase64(body);
|
note.content = LZString.compressToBase64(body);
|
||||||
|
note.createdAt = fsCreatedTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if no permission specified and have owner then give editable permission, else default permission is freely
|
// if no permission specified and have owner then give editable permission, else default permission is freely
|
||||||
|
|
Loading…
Reference in a new issue