mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
sender route should respect inbox, #3502
This commit is contained in:
parent
41b8f6882c
commit
4ae1b6e07b
@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
const imageType = require('image-type');
|
const imageType = require('image-type');
|
||||||
const imageService = require('../../services/image');
|
const imageService = require('../../services/image');
|
||||||
const dateNoteService = require('../../services/date_notes');
|
|
||||||
const noteService = require('../../services/notes');
|
const noteService = require('../../services/notes');
|
||||||
const attributeService = require('../../services/attributes');
|
|
||||||
const {sanitizeAttributeName} = require("../../services/sanitize_attribute_name.js");
|
const {sanitizeAttributeName} = require("../../services/sanitize_attribute_name.js");
|
||||||
|
const specialNotesService = require("../../services/special_notes.js");
|
||||||
|
|
||||||
function uploadImage(req) {
|
function uploadImage(req) {
|
||||||
const file = req.file;
|
const file = req.file;
|
||||||
@ -16,7 +15,7 @@ function uploadImage(req) {
|
|||||||
|
|
||||||
const originalName = `Sender image.${imageType(file.buffer).ext}`;
|
const originalName = `Sender image.${imageType(file.buffer).ext}`;
|
||||||
|
|
||||||
const parentNote = dateNoteService.getDayNote(req.headers['x-local-date']);
|
const parentNote = specialNotesService.getInboxNote(req.headers['x-local-date']);
|
||||||
|
|
||||||
const {note, noteId} = imageService.saveImage(parentNote.noteId, file.buffer, originalName, true);
|
const {note, noteId} = imageService.saveImage(parentNote.noteId, file.buffer, originalName, true);
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ function uploadImage(req) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveNote(req) {
|
function saveNote(req) {
|
||||||
const parentNote = dateNoteService.getDayNote(req.headers['x-local-date']);
|
const parentNote = specialNotesService.getInboxNote(req.headers['x-local-date']);
|
||||||
|
|
||||||
const {note, branch} = noteService.createNewNote({
|
const {note, branch} = noteService.createNewNote({
|
||||||
parentNoteId: parentNote.noteId,
|
parentNoteId: parentNote.noteId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user