diff --git a/src/public/app/services/entrypoints.js b/src/public/app/services/entrypoints.js index 20011a54d..a8d6bec10 100644 --- a/src/public/app/services/entrypoints.js +++ b/src/public/app/services/entrypoints.js @@ -1,6 +1,6 @@ import utils from "./utils.js"; import dateNoteService from "./date_notes.js"; -import hoistedNoteService from "./hoisted_note.js"; +import protectedSessionHolder from './protected_session_holder.js'; import server from "./server.js"; import appContext from "./app_context.js"; import Component from "../widgets/component.js"; @@ -69,7 +69,7 @@ export default class Entrypoints extends Component { title: 'new note', content: '', type: 'text', - isProtected: inboxNote.isProtected + isProtected: inboxNote.isProtected && protectedSessionHolder.isProtectedSessionAvailable() }); await ws.waitForMaxKnownEntityChangeId(); diff --git a/src/services/date_notes.js b/src/services/date_notes.js index 1bcea7c71..fc8a9205b 100644 --- a/src/services/date_notes.js +++ b/src/services/date_notes.js @@ -5,6 +5,7 @@ const attributeService = require('./attributes'); const dateUtils = require('./date_utils'); const repository = require('./repository'); const sql = require('./sql'); +const protectedSessionService = require('./protected_session'); const CALENDAR_ROOT_LABEL = 'calendarRoot'; const YEAR_LABEL = 'yearNote'; @@ -14,14 +15,14 @@ const DATE_LABEL = 'dateNote'; const DAYS = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; const MONTHS = ['January','February','March','April','May','June','July','August','September','October','November','December']; -function createNote(parentNoteId, noteTitle) { - return (noteService.createNewNote({ - parentNoteId: parentNoteId, +function createNote(parentNote, noteTitle) { + return noteService.createNewNote({ + parentNoteId: parentNote.noteId, title: noteTitle, content: '', - isProtected: false, + isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(), type: 'text' - })).note; + }).note; } function getNoteStartingWith(parentNoteId, startsWith) { @@ -70,7 +71,7 @@ function getYearNote(dateStr, rootNote) { if (!yearNote) { sql.transactional(() => { - yearNote = createNote(rootNote.noteId, yearStr); + yearNote = createNote(rootNote, yearStr); attributeService.createLabel(yearNote.noteId, YEAR_LABEL, yearStr); attributeService.createLabel(yearNote.noteId, 'sorted'); @@ -118,7 +119,7 @@ function getMonthNote(dateStr, rootNote) { const noteTitle = getMonthNoteTitle(rootNote, monthNumber, dateObj); sql.transactional(() => { - monthNote = createNote(yearNote.noteId, noteTitle); + monthNote = createNote(yearNote, noteTitle); attributeService.createLabel(monthNote.noteId, MONTH_LABEL, monthStr); attributeService.createLabel(monthNote.noteId, 'sorted'); @@ -166,7 +167,7 @@ function getDateNote(dateStr) { const noteTitle = getDateNoteTitle(rootNote, dayNumber, dateObj); sql.transactional(() => { - dateNote = createNote(monthNote.noteId, noteTitle); + dateNote = createNote(monthNote, noteTitle); attributeService.createLabel(dateNote.noteId, DATE_LABEL, dateStr.substr(0, 10)); diff --git a/src/services/export/zip.js b/src/services/export/zip.js index 5346dbbee..68d4d0ddb 100644 --- a/src/services/export/zip.js +++ b/src/services/export/zip.js @@ -121,7 +121,7 @@ function exportToZip(taskContext, branch, format, res) { type: note.type, mime: note.mime, // we don't export utcDateCreated and utcDateModified of any entity since that would be a bit misleading - attributes: (note.getOwnedAttributes()).map(attribute => ({ + attributes: note.getOwnedAttributes().map(attribute => ({ type: attribute.type, name: attribute.name, value: attribute.value,