Skip to content

Build your personal knowledge base with Trilium Notes

rename inheritableAttributeCache to __inheritableAttributeCache for consistency

zadamb5cfc2891240
diff --git a/src/becca/entities/bnote.js b/src/becca/entities/bnote.js
index 0be9a3ab4b..ec24fe08e7 100644
--- a/src/becca/entities/bnote.js
+++ b/src/becca/entities/bnote.js
@@ -108,7 +108,7 @@ class BNote extends AbstractBeccaEntity {
this.__attributeCache = null;
/** @type {BAttribute[]|null}
* @private */
- this.inheritableAttributeCache = null;
+ this.__inheritableAttributeCache = null;
/** @type {BAttribute[]}
* @private */
@@ -454,11 +454,11 @@ class BNote extends AbstractBeccaEntity {
}
}
- this.inheritableAttributeCache = [];
+ this.__inheritableAttributeCache = [];
for (const attr of this.__attributeCache) {
if (attr.isInheritable) {
- this.inheritableAttributeCache.push(attr);
+ this.__inheritableAttributeCache.push(attr);
}
}
}
@@ -475,11 +475,11 @@ class BNote extends AbstractBeccaEntity {
return [];
}
- if (!this.inheritableAttributeCache) {
- this.__getAttributes(path); // will refresh also this.inheritableAttributeCache
+ if (!this.__inheritableAttributeCache) {
+ this.__getAttributes(path); // will refresh also this.__inheritableAttributeCache
}
- return this.inheritableAttributeCache;
+ return this.__inheritableAttributeCache;
}
__validateTypeName(type, name) {
@@ -845,7 +845,7 @@ class BNote extends AbstractBeccaEntity {
this.flatTextCache = null;
this.__attributeCache = null;
- this.inheritableAttributeCache = null;
+ this.__inheritableAttributeCache = null;
this.ancestorCache = null;
}
diff --git a/src/etapi/mappers.js b/src/etapi/mappers.js
index ad959f36a6..86fea9c3d0 100644
--- a/src/etapi/mappers.js
+++ b/src/etapi/mappers.js
@@ -1,3 +1,4 @@
+/** @param {BNote} note */
function mapNoteToPojo(note) {
return {
noteId: note.noteId,
@@ -17,6 +18,7 @@ function mapNoteToPojo(note) {
};
}
+/** @param {BBranch} branch */
function mapBranchToPojo(branch) {
return {
branchId: branch.branchId,
@@ -29,6 +31,7 @@ function mapBranchToPojo(branch) {
};
}
+/** @param {BAttribute} attr */
function mapAttributeToPojo(attr) {
return {
attributeId: attr.attributeId,
@@ -46,4 +49,4 @@ module.exports = {
mapNoteToPojo,
mapBranchToPojo,
mapAttributeToPojo
-};
\ No newline at end of file
+};
diff --git a/src/share/shaca/entities/snote.js b/src/share/shaca/entities/snote.js
index e083ca97b2..9c8dbbfcc7 100644
--- a/src/share/shaca/entities/snote.js
+++ b/src/share/shaca/entities/snote.js
@@ -40,7 +40,7 @@ class SNote extends AbstractShacaEntity {
/** @param {SAttribute[]|null} */
this.__attributeCache = null;
/** @param {SAttribute[]|null} */
- this.inheritableAttributeCache = null;
+ this.__inheritableAttributeCache = null;
/** @param {SAttribute[]} */
this.targetRelations = [];
@@ -190,11 +190,11 @@ class SNote extends AbstractShacaEntity {
}
}
- this.inheritableAttributeCache = [];
+ this.__inheritableAttributeCache = [];
for (const attr of this.__attributeCache) {
if (attr.isInheritable) {
- this.inheritableAttributeCache.push(attr);
+ this.__inheritableAttributeCache.push(attr);
}
}
}
@@ -208,11 +208,11 @@ class SNote extends AbstractShacaEntity {
return [];
}
- if (!this.inheritableAttributeCache) {
- this.__getAttributes(path); // will refresh also this.inheritableAttributeCache
+ if (!this.__inheritableAttributeCache) {
+ this.__getAttributes(path); // will refresh also this.__inheritableAttributeCache
}
- return this.inheritableAttributeCache;
+ return this.__inheritableAttributeCache;
}
/** @returns {boolean} */
diff --git a/test-etapi/get-inherited-attribute-workaround.http b/test-etapi/get-inherited-attribute-workaround.http
deleted file mode 100644
index 527f11e699..0000000000
--- a/test-etapi/get-inherited-attribute-workaround.http
+++ /dev/null
@@ -1,67 +0,0 @@
-POST {{triliumHost}}/etapi/attributes
-Authorization: {{authToken}}
-Content-Type: application/json
-
-{
- "noteId": "root",
- "type": "label",
- "name": "mylabel",
- "value": "val",
- "isInheritable": true
-}
-
-> {% client.global.set("createdInheritedAttributeId", response.body.attributeId); %}
-
-###
-
-POST {{triliumHost}}/etapi/create-note
-Authorization: {{authToken}}
-Content-Type: application/json
-
-{
- "parentNoteId": "root",
- "title": "Hello",
- "type": "text",
- "content": "Hi there!"
-}
-
-> {%
-client.global.set("createdNoteId", response.body.note.noteId);
-client.global.set("createdBranchId", response.body.branch.branchId);
-%}
-
-###
-
-POST {{triliumHost}}/etapi/attributes
-Authorization: {{authToken}}
-Content-Type: application/json
-
-{
- "noteId": "{{createdNoteId}}",
- "type": "label",
- "name": "mylabel",
- "value": "val",
- "isInheritable": false
-}
-
-> {% client.global.set("createdOwnedAttributeId", response.body.attributeId); %}
-
-###
-
-DELETE {{triliumHost}}/etapi/attributes/{{createdOwnedAttributeId}}
-Authorization: {{authToken}}
-
-> {% client.assert(response.status === 204); %}
-
-###
-
-GET {{triliumHost}}/etapi/notes/{{createdNoteId}}
-Authorization: {{authToken}}
-
-> {%
-client.assert(response.status === 200);
-client.assert(response.body.noteId == client.global.get("createdNoteId"));
-client.assert(response.body.attributes.length == 1);
-client.assert(response.body.attributes[0].attributeId ==
- client.global.get("createdInheritedAttributeId"));
-%}