@@ -8,7 +8,6 @@ const { newCheckViewPermission, errorForbidden, responseCodiMD, errorNotFound, e
88const { updateHistory, historyDelete } = require ( '../history' )
99const { actionPublish, actionSlide, actionInfo, actionDownload, actionPDF, actionGist, actionRevision, actionPandoc } = require ( './noteActions' )
1010const realtime = require ( '../realtime/realtime' )
11- const moment = require ( 'moment' )
1211
1312async function getNoteById ( noteId , { includeUser } = { includeUser : false } ) {
1413 const id = await Note . parseNoteIdAsync ( noteId )
@@ -291,7 +290,7 @@ const updateNote = async (req, res) => {
291290 const content = req . body . content
292291 const updated = await note . update ( {
293292 content : content ,
294- lastchangeAt : moment ( now ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ,
293+ lastchangeAt : now ,
295294 authorship : [
296295 [
297296 req . user . id ,
@@ -309,14 +308,17 @@ const updateNote = async (req, res) => {
309308 }
310309
311310 Revision . saveNoteRevision ( note , ( err , revision ) => {
312- if ( err ) return errorInternalError ( req , res )
311+ if ( err ) {
312+ logger . error ( err )
313+ return errorInternalError ( req , res )
314+ }
313315 if ( ! revision ) return errorNotFound ( req , res )
314- } )
315-
316- res . send ( {
317- status : 'ok'
316+ res . send ( {
317+ status : 'ok'
318+ } )
318319 } )
319320 } catch ( err ) {
321+ logger . error ( err )
320322 logger . error ( 'Update note failed: Internal Error.' )
321323 return errorInternalError ( req , res )
322324 }
0 commit comments