From 181d5646cfbde303cf3335c5dea51232d874b0f1 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 27 Oct 2019 14:57:45 +0100 Subject: Move note actions into their own file Signed-off-by: David Mehren --- lib/web/note/controller.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/web/note/controller.js') diff --git a/lib/web/note/controller.js b/lib/web/note/controller.js index c89cc5de..d6bbe0e7 100644 --- a/lib/web/note/controller.js +++ b/lib/web/note/controller.js @@ -4,12 +4,11 @@ const models = require('../../models') const logger = require('../../logger') const config = require('../../config') const errors = require('../../errors') -const fs = require('fs') -const shortId = require('shortid') -const markdownpdf = require('markdown-pdf') -const moment = require('moment') -const querystring = require('querystring') + const noteUtil = require('./util') +const noteActions = require('./actions') + + exports.createFromPOST = function (req, res, next) { let body = '' @@ -38,21 +37,21 @@ exports.doAction = function (req, res, next) { exports.downloadMarkdown(req, res, note) break case 'info': - getInfo(req, res, note) + noteActions.getInfo(req, res, note) break case 'pdf': if (config.allowPDFExport) { - createPDF(req, res, note) + noteActions.createPDF(req, res, note) } else { logger.error('PDF export failed: Disabled by config. Set "allowPDFExport: true" to enable. Check the documentation for details') errors.errorForbidden(res) } break case 'gist': - createGist(req, res, note) + noteActions.createGist(req, res, note) break case 'revision': - getRevision(req, res, note) + noteActions.getRevision(req, res, note) break default: return res.redirect(config.serverURL + '/' + noteId) -- cgit v1.2.3