mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-03-28 03:23:42 +00:00
ESLint fixes for Notes
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
acdd627027
commit
5cda02590b
5 changed files with 269 additions and 277 deletions
src/lib
|
@ -6,7 +6,7 @@ import fs from 'fs'
|
|||
|
||||
import { logger } from './logger'
|
||||
|
||||
import { NoteUtils } from './web/note/util'
|
||||
import * as NoteUtils from './web/note/util'
|
||||
|
||||
import { errors } from './errors'
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import { NextFunction, Request, Response } from 'express'
|
||||
import { NoteUtils } from './util'
|
||||
import * as ActionController from './actions'
|
||||
import { errors } from '../../errors'
|
||||
import { config } from '../../config'
|
||||
import { errors } from '../../errors'
|
||||
import { logger } from '../../logger'
|
||||
import { User, Note } from '../../models'
|
||||
import { Note, User } from '../../models'
|
||||
import * as ActionController from './actions'
|
||||
import * as NoteUtils from './util'
|
||||
|
||||
export module NoteController {
|
||||
export function publishNoteActions (req: any, res: Response, next: NextFunction) {
|
||||
NoteUtils.findNoteOrCreate(req, res, function (note) {
|
||||
const action = req.params.action
|
||||
|
@ -137,4 +136,3 @@ export module NoteController {
|
|||
})
|
||||
res.send(body)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { markdownParser } from '../utils'
|
||||
|
||||
import { SlideController } from './slide'
|
||||
import { NoteController } from './controller'
|
||||
import { Router } from 'express'
|
||||
import { markdownParser } from '../utils'
|
||||
import * as NoteController from './controller'
|
||||
|
||||
import * as SlideController from './slide'
|
||||
|
||||
const NoteRouter = Router()
|
||||
// get new note
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
import { NextFunction, Response } from "express";
|
||||
import { NoteUtils } from "./util";
|
||||
import { NextFunction, Response } from 'express'
|
||||
import { config } from '../../config'
|
||||
import { errors } from '../../errors'
|
||||
import { logger } from '../../logger'
|
||||
import { config } from '../../config'
|
||||
import { User } from "../../models/user";
|
||||
import { Note } from "../../models/note";
|
||||
import { Note, User } from '../../models'
|
||||
import * as NoteUtils from './util'
|
||||
|
||||
|
||||
export module SlideController {
|
||||
export function publishSlideActions (req: any, res: Response, next: NextFunction) {
|
||||
NoteUtils.findNoteOrCreate(req, res, function (note) {
|
||||
const action = req.params.action
|
||||
if (action === 'edit') {
|
||||
res.redirect(config.serverURL + '/' + (note.alias ? note.alias : Note.encodeNoteId(note.id)) + '?both')
|
||||
} else { res.redirect(config.serverURL + '/p/' + note.shortid) }
|
||||
} else {
|
||||
res.redirect(config.serverURL + '/p/' + note.shortid)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function showPublishSlide (req: any, res: Response, next: NextFunction) {
|
||||
const include = [{
|
||||
model: User,
|
||||
|
@ -49,4 +46,3 @@ export module SlideController {
|
|||
})
|
||||
}, include)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import { Includeable } from 'sequelize'
|
||||
import { Response } from 'express'
|
||||
import fs from 'fs'
|
||||
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import { errors } from '../../errors'
|
||||
import { Includeable } from 'sequelize'
|
||||
import { config } from '../../config'
|
||||
import { errors } from '../../errors'
|
||||
import { logger } from '../../logger'
|
||||
import { Note, User } from '../../models'
|
||||
|
||||
export module NoteUtils {
|
||||
export function findNoteOrCreate (req, res, callback: (note: any) => void, include?: Includeable[]) {
|
||||
const id = req.params.noteId || req.params.shortid
|
||||
Note.parseNoteId(id, function (err, _id) {
|
||||
|
@ -110,4 +109,3 @@ export module NoteUtils {
|
|||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue