From 9dd74da17f10eb90318a2c2053d05061c3b9df45 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Wed, 11 Nov 2020 21:24:55 +0100 Subject: Save note title to database when creating a note Currently, when creating a note with content via the API, a title is only saved to the database after visiting the note with the browser. This commit makes sure that a title is saved at creation time. Closes #306 Signed-off-by: David Mehren --- lib/web/note/util.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/web/note/util.js b/lib/web/note/util.js index f1af1300..9c6c1c8a 100644 --- a/lib/web/note/util.js +++ b/lib/web/note/util.js @@ -59,7 +59,8 @@ exports.newNote = function (req, res, body) { models.Note.create({ ownerId: owner, alias: req.alias ? req.alias : null, - content: body + content: body, + title: models.Note.parseNoteTitle(body) }).then(function (note) { return res.redirect(config.serverURL + '/' + (note.alias ? note.alias : models.Note.encodeNoteId(note.id))) }).catch(function (err) { -- cgit v1.2.3