@@ -8,7 +8,6 @@ const { newCheckViewPermission, errorForbidden, responseCodiMD, errorNotFound, e
8
8
const { updateHistory, historyDelete } = require ( '../history' )
9
9
const { actionPublish, actionSlide, actionInfo, actionDownload, actionPDF, actionGist, actionRevision, actionPandoc } = require ( './noteActions' )
10
10
const realtime = require ( '../realtime/realtime' )
11
- const moment = require ( 'moment' )
12
11
13
12
async function getNoteById ( noteId , { includeUser } = { includeUser : false } ) {
14
13
const id = await Note . parseNoteIdAsync ( noteId )
@@ -291,7 +290,7 @@ const updateNote = async (req, res) => {
291
290
const content = req . body . content
292
291
const updated = await note . update ( {
293
292
content : content ,
294
- lastchangeAt : moment ( now ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ,
293
+ lastchangeAt : now ,
295
294
authorship : [
296
295
[
297
296
req . user . id ,
@@ -309,14 +308,17 @@ const updateNote = async (req, res) => {
309
308
}
310
309
311
310
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
+ }
313
315
if ( ! revision ) return errorNotFound ( req , res )
314
- } )
315
-
316
- res . send ( {
317
- status : 'ok'
316
+ res . send ( {
317
+ status : 'ok'
318
+ } )
318
319
} )
319
320
} catch ( err ) {
321
+ logger . error ( err )
320
322
logger . error ( 'Update note failed: Internal Error.' )
321
323
return errorInternalError ( req , res )
322
324
}
0 commit comments