mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
Added endpoint for note-creation with given alias
Signed-off-by: Erik Michelson <erik@liltv.de>
This commit is contained in:
parent
529075fd67
commit
8d29d74b02
2 changed files with 4 additions and 2 deletions
|
@ -123,10 +123,10 @@ function newNote (req, res, next) {
|
|||
}
|
||||
models.Note.create({
|
||||
ownerId: owner,
|
||||
alias: req.alias ? req.alias : null,
|
||||
alias: req.alias ? req.alias : (config.allowFreeURL ? (req.params.alias ? req.params.alias : null) : null),
|
||||
content: body
|
||||
}).then(function (note) {
|
||||
return res.redirect(config.serverURL + '/' + models.Note.encodeNoteId(note.id))
|
||||
return res.redirect(config.serverURL + '/' + (note.alias ? note.alias : models.Note.encodeNoteId(note.id)))
|
||||
}).catch(function (err) {
|
||||
logger.error(err)
|
||||
return response.errorInternalError(res)
|
||||
|
|
|
@ -12,6 +12,8 @@ const noteRouter = module.exports = Router()
|
|||
noteRouter.get('/new', response.newNote)
|
||||
// post new note with content
|
||||
noteRouter.post('/new', markdownParser, response.newNote)
|
||||
// post new note with content and alias
|
||||
noteRouter.post('/new/:alias', markdownParser, response.newNote)
|
||||
// get publish note
|
||||
noteRouter.get('/s/:shortid', response.showPublishNote)
|
||||
// publish note actions
|
||||
|
|
Loading…
Reference in a new issue