mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-09 13:51:57 -04:00
Rename actions.js to controller.js and rename functions to be more descriptive
Move postNote to NoteController and rename to createFromPost Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
afb317b551
commit
30487f7c01
3 changed files with 33 additions and 34 deletions
|
@ -9,7 +9,7 @@ var config = require('./config')
|
|||
var logger = require('./logger')
|
||||
var models = require('./models')
|
||||
const noteUtil = require('./web/note/util')
|
||||
const noteActions = require('./web/note/actions')
|
||||
const noteController = require('./web/note/controller')
|
||||
const errors = require('./errors')
|
||||
|
||||
// public
|
||||
|
@ -17,7 +17,6 @@ var response = {
|
|||
showNote: showNote,
|
||||
showPublishNote: showPublishNote,
|
||||
showIndex: showIndex,
|
||||
postNote: postNote,
|
||||
publishNoteActions: publishNoteActions,
|
||||
githubActions: githubActions,
|
||||
gitlabActions: gitlabActions
|
||||
|
@ -70,17 +69,6 @@ function responseCodiMD (res, note) {
|
|||
})
|
||||
}
|
||||
|
||||
function postNote (req, res, next) {
|
||||
var body = ''
|
||||
if (req.body && req.body.length > config.documentMaxLength) {
|
||||
return errors.errorTooLong(res)
|
||||
} else if (req.body) {
|
||||
body = req.body
|
||||
}
|
||||
body = body.replace(/[\r]/g, '')
|
||||
return noteUtil.newNote(req, res, body)
|
||||
}
|
||||
|
||||
function showNote (req, res, next) {
|
||||
noteUtil.findNote(req, res, function (note) {
|
||||
// force to use note id
|
||||
|
@ -156,7 +144,7 @@ function publishNoteActions (req, res, next) {
|
|||
var action = req.params.action
|
||||
switch (action) {
|
||||
case 'download':
|
||||
noteActions.actionDownload(req, res, note)
|
||||
noteController.downloadMarkdown(req, res, note)
|
||||
break
|
||||
case 'edit':
|
||||
res.redirect(config.serverURL + '/' + (note.alias ? note.alias : models.Note.encodeNoteId(note.id)) + '?both')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue