summaryrefslogtreecommitdiff
path: root/lib/web/note
diff options
context:
space:
mode:
authorDavid Mehren2020-11-11 21:24:55 +0100
committerDavid Mehren2020-11-11 21:24:55 +0100
commit9dd74da17f10eb90318a2c2053d05061c3b9df45 (patch)
tree07c574d284c9c53125844dde19096ece4b9666e5 /lib/web/note
parente28bc8eab4f5b2ed7a59b0297d7c47e5b37afa40 (diff)
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 <git@herrmehren.de>
Diffstat (limited to '')
-rw-r--r--lib/web/note/util.js3
1 files changed, 2 insertions, 1 deletions
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) {