Update note title and history in update api

Signed-off-by: James Tsai <jamesscamel@gmail.com>
This commit is contained in:
James Tsai 2020-08-04 16:47:57 +08:00
parent 091c77bdb1
commit e7a4996cbe

View File

@ -289,6 +289,7 @@ const updateNote = async (req, res) => {
const now = Date.now()
const content = req.body.content
const updated = await note.update({
title: Note.parseNoteTitle(content),
content: content,
lastchangeAt: now,
authorship: [
@ -307,6 +308,8 @@ const updateNote = async (req, res) => {
return errorInternalError(req, res)
}
updateHistory(req.user.id, note)
Revision.saveNoteRevision(note, (err, revision) => {
if (err) {
logger.error(err)