@@ -8,7 +8,7 @@ const { newCheckViewPermission, errorForbidden, responseCodiMD, errorNotFound, e
8
8
const { updateHistory } = require ( '../history' )
9
9
const { actionPublish, actionSlide, actionInfo, actionDownload, actionPDF, actionGist, actionRevision, actionPandoc } = require ( './noteActions' )
10
10
11
- async function getNoteById ( noteId , { includeUser } = { includeUser : false } ) {
11
+ async function getNoteById ( noteId , { includeUser } = { includeUser : false } ) {
12
12
const id = await Note . parseNoteIdAsync ( noteId )
13
13
14
14
const includes = [ ]
@@ -32,7 +32,7 @@ async function getNoteById(noteId, { includeUser } = { includeUser: false }) {
32
32
return note
33
33
}
34
34
35
- async function createNote ( userId , noteAlias ) {
35
+ async function createNote ( userId , noteAlias ) {
36
36
if ( ! config . allowAnonymous && ! userId ) {
37
37
throw new Error ( 'can not create note' )
38
38
}
@@ -50,7 +50,7 @@ async function createNote(userId, noteAlias) {
50
50
}
51
51
52
52
// controller
53
- async function showNote ( req , res ) {
53
+ async function showNote ( req , res ) {
54
54
const noteId = req . params . noteId
55
55
const userId = req . user ? req . user . id : null
56
56
@@ -78,7 +78,7 @@ async function showNote(req, res) {
78
78
return responseCodiMD ( res , note )
79
79
}
80
80
81
- function canViewNote ( note , isLogin , userId ) {
81
+ function canViewNote ( note , isLogin , userId ) {
82
82
if ( note . permission === 'private' ) {
83
83
return note . ownerId === userId
84
84
}
@@ -88,7 +88,7 @@ function canViewNote(note, isLogin, userId) {
88
88
return true
89
89
}
90
90
91
- async function showPublishNote ( req , res ) {
91
+ async function showPublishNote ( req , res ) {
92
92
const shortid = req . params . shortid
93
93
94
94
const note = await getNoteById ( shortid , {
@@ -141,7 +141,7 @@ async function showPublishNote(req, res) {
141
141
res . render ( 'pretty.ejs' , data )
142
142
}
143
143
144
- async function noteActions ( req , res ) {
144
+ async function noteActions ( req , res ) {
145
145
const noteId = req . params . noteId
146
146
147
147
const note = await getNoteById ( noteId )
@@ -189,7 +189,7 @@ async function noteActions(req, res) {
189
189
}
190
190
}
191
191
192
- async function getMyNoteList ( userId , callback ) {
192
+ async function getMyNoteList ( userId , callback ) {
193
193
const myNotes = await Note . findAll ( {
194
194
where : {
195
195
ownerId : userId
@@ -217,7 +217,7 @@ async function getMyNoteList(userId, callback) {
217
217
}
218
218
}
219
219
220
- function listMyNotes ( req , res ) {
220
+ function listMyNotes ( req , res ) {
221
221
if ( req . isAuthenticated ( ) ) {
222
222
getMyNoteList ( req . user . id , ( err , myNoteList ) => {
223
223
if ( err ) return errorInternalError ( req , res )
0 commit comments