Merge pull request #566 from codimd/fix/306-api-titles

Save note title to database when creating a note
This commit is contained in:
David Mehren 2020-11-12 19:01:45 +01:00 committed by GitHub
commit db2fcdb516
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,7 +59,8 @@ exports.newNote = function (req, res, body) {
models.Note.create({ models.Note.create({
ownerId: owner, ownerId: owner,
alias: req.alias ? req.alias : null, alias: req.alias ? req.alias : null,
content: body content: body,
title: models.Note.parseNoteTitle(body)
}).then(function (note) { }).then(function (note) {
return res.redirect(config.serverURL + '/' + (note.alias ? note.alias : models.Note.encodeNoteId(note.id))) return res.redirect(config.serverURL + '/' + (note.alias ? note.alias : models.Note.encodeNoteId(note.id)))
}).catch(function (err) { }).catch(function (err) {