mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	fixes
This commit is contained in:
		
							parent
							
								
									00453fc151
								
							
						
					
					
						commit
						69c7eb14aa
					
				@ -93,6 +93,8 @@ class AbstractBeccaEntity {
 | 
			
		||||
 | 
			
		||||
        const pojo = this.getPojoToSave();
 | 
			
		||||
 | 
			
		||||
        console.log(pojo);
 | 
			
		||||
 | 
			
		||||
        sql.transactional(() => {
 | 
			
		||||
            sql.upsert(entityName, primaryKeyName, pojo);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -190,7 +190,7 @@ class BAttribute extends AbstractBeccaEntity {
 | 
			
		||||
 | 
			
		||||
        if (this.position === undefined || this.position === null) {
 | 
			
		||||
            const maxExistingPosition = this.getNote().getAttributes()
 | 
			
		||||
                .reduce((maxPosition, attr) => Math.max(maxPosition, attr.position), 0);
 | 
			
		||||
                .reduce((maxPosition, attr) => Math.max(maxPosition, attr.position || 0), 0);
 | 
			
		||||
 | 
			
		||||
            this.position = maxExistingPosition + 10;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -117,6 +117,10 @@ export default class LoadResults {
 | 
			
		||||
        return this.optionNames.includes(name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    getOptionNames() {
 | 
			
		||||
        return this.optionNames;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    addAttachmentRow(attachment) {
 | 
			
		||||
        this.attachmentRows.push(attachment);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@ export default class OptionsWidget extends NoteContextAwareWidget {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async entitiesReloadedEvent({loadResults}) {
 | 
			
		||||
        if (loadResults.options.length > 0) {
 | 
			
		||||
        if (loadResults.getOptionNames().length > 0) {
 | 
			
		||||
            this.refresh();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -150,7 +150,10 @@ function fillInAdditionalProperties(entityChange) {
 | 
			
		||||
    } else if (entityChange.entityName === 'blobs') {
 | 
			
		||||
        entityChange.noteIds = sql.getColumn("SELECT noteId FROM notes WHERE blobId = ? AND isDeleted = 0", [entityChange.entityId]);
 | 
			
		||||
    } else if (entityChange.entityName === 'attachments') {
 | 
			
		||||
        entityChange.entity = becca.getAttachment(entityChange.entityId, {includeContentLength: true});
 | 
			
		||||
        entityChange.entity = sql.getRow(`SELECT attachments.*, LENGTH(blobs.content) AS contentLength
 | 
			
		||||
                                                FROM attachments
 | 
			
		||||
                                                JOIN blobs USING (blobId)
 | 
			
		||||
                                                WHERE attachmentId = ?`, [entityChange.entityId]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (entityChange.entity instanceof AbstractBeccaEntity) {
 | 
			
		||||
 | 
			
		||||
@ -85,7 +85,7 @@ Authorization: {{authToken}}
 | 
			
		||||
> {%
 | 
			
		||||
    client.assert(response.status === 200);
 | 
			
		||||
    client.assert(response.body.branchId == client.global.get("clonedBranchId"));
 | 
			
		||||
    client.assert(response.body.parentNoteId == '_hidden');
 | 
			
		||||
    client.assert(response.body.parentNoteId == "_hidden");
 | 
			
		||||
%}
 | 
			
		||||
 | 
			
		||||
###
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ Content-Type: application/json
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  "noteId": "{{createdNoteId}}",
 | 
			
		||||
  "parentNoteId": '_hidden'
 | 
			
		||||
  "parentNoteId": "_hidden"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
> {% client.global.set("clonedBranchId", response.body.branchId); %}
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,7 @@ Content-Type: application/json
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  "noteId": "{{createdNoteId}}",
 | 
			
		||||
  "parentNoteId": '_hidden'
 | 
			
		||||
  "parentNoteId": "_hidden"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
> {% client.global.set("clonedBranchId", response.body.branchId); %}
 | 
			
		||||
 | 
			
		||||
@ -21,5 +21,5 @@ Authorization: {{authToken}}
 | 
			
		||||
 | 
			
		||||
> {%
 | 
			
		||||
    client.assert(response.status === 200);
 | 
			
		||||
    client.assert(response.body === "<p>Hi there!</p>");
 | 
			
		||||
    client.assert(response.body === "Hi there!");
 | 
			
		||||
%}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user