From cea54aecad76797515b463fc6198bf6e0503693f Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 14 Jul 2023 21:18:56 +0200 Subject: [PATCH] check the attachment after conversion --- src/becca/entities/battachment.js | 4 +--- src/becca/entities/bnote.js | 3 +++ src/public/app/widgets/attachment_detail.js | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/becca/entities/battachment.js b/src/becca/entities/battachment.js index 6772710c2..9da0835f9 100644 --- a/src/becca/entities/battachment.js +++ b/src/becca/entities/battachment.js @@ -124,9 +124,7 @@ class BAttachment extends AbstractBeccaEntity { this._setContent(content, opts); } - /** - * @returns {{note: BNote, branch: BBranch}} - */ + /** @returns {{note: BNote, branch: BBranch}} */ convertToNote() { if (this.type === 'search') { throw new Error(`Note of type search cannot have child notes`); diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.js index c21ecc843..4225908a9 100644 --- a/src/becca/entities/bnote.js +++ b/src/becca/entities/bnote.js @@ -1495,6 +1495,9 @@ class BNote extends AbstractBeccaEntity { parentNote.setContent(fixedContent); + const noteService = require("../../services/notes"); + noteService.asyncPostProcessContent(parentNote, fixedContent); + this.deleteNote(); return attachment; diff --git a/src/public/app/widgets/attachment_detail.js b/src/public/app/widgets/attachment_detail.js index 8c68ebac7..8c034b8cd 100644 --- a/src/public/app/widgets/attachment_detail.js +++ b/src/public/app/widgets/attachment_detail.js @@ -153,12 +153,12 @@ export default class AttachmentDetailWidget extends BasicWidget { $deletionWarning.show(); if (willBeDeletedInMs >= 60000) { - $deletionWarning.text(`This attachment will be deleted in ${utils.formatTimeInterval(willBeDeletedInMs)}`); + $deletionWarning.text(`This attachment will be automatically deleted in ${utils.formatTimeInterval(willBeDeletedInMs)}`); } else { - $deletionWarning.text(`This attachment will be deleted soon`); + $deletionWarning.text(`This attachment will be automatically deleted soon`); } - $deletionWarning.append(", because the attachment is not linked in the note's content. To prevent deletion, add the attachment link back into the content."); + $deletionWarning.append(", because the attachment is not linked in the note's content. To prevent deletion, add the attachment link back into the content or convert the attachment into note."); } else { this.$wrapper.removeClass("scheduled-for-deletion"); $deletionWarning.hide(); @@ -185,11 +185,11 @@ export default class AttachmentDetailWidget extends BasicWidget { }); utils.copyHtmlToClipboard($link[0].outerHTML); + + toastService.showMessage("Attachment link copied to clipboard."); } else { throw new Error(`Unrecognized attachment role '${this.attachment.role}'.`); } - - toastService.showMessage("Attachment link copied to clipboard."); } async entitiesReloadedEvent({loadResults}) {