@@ -116,7 +116,7 @@ function parseHistoryToObject (history) {
116116function historyGet ( req , res ) {
117117 if ( req . isAuthenticated ( ) ) {
118118 getHistory ( req . user . id , function ( err , history ) {
119- if ( err ) return response . errorInternalError ( res )
119+ if ( err ) return response . errorInternalError ( req , res )
120120 if ( ! history ) return response . errorNotFound ( req , res )
121121 res . send ( {
122122 history : parseHistoryToArray ( history )
@@ -140,7 +140,7 @@ function historyPost (req, res) {
140140 }
141141 if ( Array . isArray ( history ) ) {
142142 setHistory ( req . user . id , history , function ( err , count ) {
143- if ( err ) return response . errorInternalError ( res )
143+ if ( err ) return response . errorInternalError ( req , res )
144144 res . end ( )
145145 } )
146146 } else {
@@ -149,13 +149,13 @@ function historyPost (req, res) {
149149 } else {
150150 if ( typeof req . body [ 'pinned' ] === 'undefined' ) return response . errorBadRequest ( req , res )
151151 getHistory ( req . user . id , function ( err , history ) {
152- if ( err ) return response . errorInternalError ( res )
152+ if ( err ) return response . errorInternalError ( req , res )
153153 if ( ! history ) return response . errorNotFound ( req , res )
154154 if ( ! history [ noteId ] ) return response . errorNotFound ( req , res )
155155 if ( req . body . pinned === 'true' || req . body . pinned === 'false' ) {
156156 history [ noteId ] . pinned = ( req . body . pinned === 'true' )
157157 setHistory ( req . user . id , history , function ( err , count ) {
158- if ( err ) return response . errorInternalError ( res )
158+ if ( err ) return response . errorInternalError ( req , res )
159159 res . end ( )
160160 } )
161161 } else {
@@ -173,16 +173,16 @@ function historyDelete (req, res) {
173173 var noteId = req . params . noteId
174174 if ( ! noteId ) {
175175 setHistory ( req . user . id , [ ] , function ( err , count ) {
176- if ( err ) return response . errorInternalError ( res )
176+ if ( err ) return response . errorInternalError ( req , res )
177177 res . end ( )
178178 } )
179179 } else {
180180 getHistory ( req . user . id , function ( err , history ) {
181- if ( err ) return response . errorInternalError ( res )
181+ if ( err ) return response . errorInternalError ( req , res )
182182 if ( ! history ) return response . errorNotFound ( req , res )
183183 delete history [ noteId ]
184184 setHistory ( req . user . id , history , function ( err , count ) {
185- if ( err ) return response . errorInternalError ( res )
185+ if ( err ) return response . errorInternalError ( req , res )
186186 res . end ( )
187187 } )
188188 } )
0 commit comments