add api.runOutsideOfSync() to backend script API, #4327

This commit is contained in:
zadam
2023-10-19 00:29:03 +02:00
parent 67a12d3c4d
commit 0a172d8bc1
17 changed files with 1572 additions and 617 deletions

View File

@@ -160,11 +160,17 @@ class BNote extends AbstractBeccaEntity {
*/
this.contentSize = null;
/**
* size of the content and note revision contents in bytes
* size of the note content, attachment contents in bytes
* @type {int|null}
* @private
*/
this.noteSize = null;
this.contentAndAttachmentsSize = null;
/**
* size of the note content, attachment contents and revision contents in bytes
* @type {int|null}
* @private
*/
this.contentAndAttachmentsAndRevisionsSize = null;
/**
* number of note revisions for this note
* @type {int|null}
@@ -1635,16 +1641,12 @@ class BNote extends AbstractBeccaEntity {
revision.save(); // to generate revisionId, which is then used to save attachments
if (this.type === 'text') {
for (const noteAttachment of this.getAttachments()) {
if (noteAttachment.utcDateScheduledForErasureSince) {
continue;
}
const revisionAttachment = noteAttachment.copy();
revisionAttachment.ownerId = revision.revisionId;
revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});
for (const noteAttachment of this.getAttachments()) {
const revisionAttachment = noteAttachment.copy();
revisionAttachment.ownerId = revision.revisionId;
revisionAttachment.setContent(noteAttachment.getContent(), {forceSave: true});
if (this.type === 'text') {
// content is rewritten to point to the revision attachments
noteContent = noteContent.replaceAll(`attachments/${noteAttachment.attachmentId}`,
`attachments/${revisionAttachment.attachmentId}`);