Fix linter

Signed-off-by: James Tsai <jamesscamel@gmail.com>
This commit is contained in:
James Tsai 2020-07-14 16:08:10 +08:00
parent a22cf73f60
commit 03bc329b3f
1 changed files with 8 additions and 8 deletions

View File

@ -8,7 +8,7 @@ const { newCheckViewPermission, errorForbidden, responseCodiMD, errorNotFound, e
const { updateHistory } = require('../history')
const { actionPublish, actionSlide, actionInfo, actionDownload, actionPDF, actionGist, actionRevision, actionPandoc } = require('./noteActions')
async function getNoteById(noteId, { includeUser } = { includeUser: false }) {
async function getNoteById (noteId, { includeUser } = { includeUser: false }) {
const id = await Note.parseNoteIdAsync(noteId)
const includes = []
@ -32,7 +32,7 @@ async function getNoteById(noteId, { includeUser } = { includeUser: false }) {
return note
}
async function createNote(userId, noteAlias) {
async function createNote (userId, noteAlias) {
if (!config.allowAnonymous && !userId) {
throw new Error('can not create note')
}
@ -50,7 +50,7 @@ async function createNote(userId, noteAlias) {
}
// controller
async function showNote(req, res) {
async function showNote (req, res) {
const noteId = req.params.noteId
const userId = req.user ? req.user.id : null
@ -78,7 +78,7 @@ async function showNote(req, res) {
return responseCodiMD(res, note)
}
function canViewNote(note, isLogin, userId) {
function canViewNote (note, isLogin, userId) {
if (note.permission === 'private') {
return note.ownerId === userId
}
@ -88,7 +88,7 @@ function canViewNote(note, isLogin, userId) {
return true
}
async function showPublishNote(req, res) {
async function showPublishNote (req, res) {
const shortid = req.params.shortid
const note = await getNoteById(shortid, {
@ -141,7 +141,7 @@ async function showPublishNote(req, res) {
res.render('pretty.ejs', data)
}
async function noteActions(req, res) {
async function noteActions (req, res) {
const noteId = req.params.noteId
const note = await getNoteById(noteId)
@ -189,7 +189,7 @@ async function noteActions(req, res) {
}
}
async function getMyNoteList(userId, callback) {
async function getMyNoteList (userId, callback) {
const myNotes = await Note.findAll({
where: {
ownerId: userId
@ -217,7 +217,7 @@ async function getMyNoteList(userId, callback) {
}
}
function listMyNotes(req, res) {
function listMyNotes (req, res) {
if (req.isAuthenticated()) {
getMyNoteList(req.user.id, (err, myNoteList) => {
if (err) return errorInternalError(req, res)