diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.js index 7dc0cb92f..2e00b7824 100644 --- a/src/becca/entities/bnote.js +++ b/src/becca/entities/bnote.js @@ -1106,16 +1106,19 @@ class BNote extends AbstractBeccaEntity { return minDistance; } + /** @returns {BNoteRevision[]} */ getNoteRevisions() { return sql.getRows("SELECT * FROM note_revisions WHERE noteId = ?", [this.noteId]) .map(row => new BNoteRevision(row)); } + /** @returns {BNoteAttachment[]} */ getNoteAttachments() { return sql.getRows("SELECT * FROM note_attachments WHERE noteId = ? AND isDeleted = 0", [this.noteId]) .map(row => new BNoteAttachment(row)); } + /** @returns {BNoteAttachment|undefined} */ getNoteAttachmentByName(name) { return sql.getRows("SELECT * FROM note_attachments WHERE noteId = ? AND name = ? AND isDeleted = 0", [this.noteId, name]) .map(row => new BNoteAttachment(row)) @@ -1442,6 +1445,7 @@ class BNote extends AbstractBeccaEntity { this.getNoteAttachments() const noteAttachment = new BNoteAttachment({ + noteId: this.noteId, name, mime, isProtected: this.isProtected diff --git a/src/becca/entities/bnote_attachment.js b/src/becca/entities/bnote_attachment.js index b60476d29..e48707da0 100644 --- a/src/becca/entities/bnote_attachment.js +++ b/src/becca/entities/bnote_attachment.js @@ -125,12 +125,12 @@ class BNoteAttachment extends AbstractBeccaEntity { return { noteAttachmentId: this.noteAttachmentId, noteId: this.noteId, - mime: this.mime, - isProtected: this.isProtected, name: this.name, + mime: this.mime, + isProtected: !!this.isProtected, + isDeleted: false, utcDateModified: this.utcDateModified, content: this.content, - contentLength: this.contentLength }; } diff --git a/src/public/app/components/root_command_executor.js b/src/public/app/components/root_command_executor.js index 917f45af4..63b810d54 100644 --- a/src/public/app/components/root_command_executor.js +++ b/src/public/app/components/root_command_executor.js @@ -88,8 +88,12 @@ export default class RootCommandExecutor extends Component { await this.showAndHoistSubtree('_hidden'); } - async showOptionsCommand() { - await this.showAndHoistSubtree('_options'); + async showOptionsCommand({section}) { + await appContext.tabManager.openContextWithNote( + section || '_options', + true, + null, + '_options'); } async showSQLConsoleHistoryCommand() { diff --git a/src/public/app/widgets/dialogs/password_not_set.js b/src/public/app/widgets/dialogs/password_not_set.js index a1fc40044..011cc51d4 100644 --- a/src/public/app/widgets/dialogs/password_not_set.js +++ b/src/public/app/widgets/dialogs/password_not_set.js @@ -28,7 +28,7 @@ export default class PasswordNoteSetDialog extends BasicWidget { this.$widget = $(TPL); this.$openPasswordOptionsButton = this.$widget.find(".open-password-options-button"); this.$openPasswordOptionsButton.on("click", () => { - this.triggerCommand("showOptions", { openTab: 'PasswordOptions' }); + this.triggerCommand("showOptions", { section: '_optionsPassword' }); }); } diff --git a/src/public/app/widgets/dialogs/recent_changes.js b/src/public/app/widgets/dialogs/recent_changes.js index f0e82a7cc..4a7158180 100644 --- a/src/public/app/widgets/dialogs/recent_changes.js +++ b/src/public/app/widgets/dialogs/recent_changes.js @@ -8,6 +8,7 @@ import hoistedNoteService from "../../services/hoisted_note.js"; import BasicWidget from "../basic_widget.js"; import dialogService from "../../services/dialog.js"; import toastService from "../../services/toast.js"; +import ws from "../../services/ws.js"; const TPL = `