diff --git a/docs/backend_api/Note.html b/docs/backend_api/Note.html index b8f53d2d9..23a38a14c 100644 --- a/docs/backend_api/Note.html +++ b/docs/backend_api/Note.html @@ -1026,7 +1026,7 @@
Source:
@@ -1404,7 +1404,7 @@
Source:
@@ -1666,7 +1666,7 @@
Source:
@@ -1772,7 +1772,7 @@
Source:
@@ -1946,7 +1946,7 @@
Source:
@@ -2324,7 +2324,7 @@
Source:
@@ -2951,7 +2951,7 @@
Source:
@@ -3208,7 +3208,7 @@
Source:
@@ -3378,7 +3378,7 @@
Source:
@@ -3533,7 +3533,7 @@
Source:
@@ -3703,7 +3703,7 @@
Source:
@@ -3809,7 +3809,7 @@
Source:
@@ -4044,7 +4044,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4222,7 +4222,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4380,7 +4380,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4550,7 +4550,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4705,7 +4705,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -4875,7 +4875,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5030,7 +5030,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5200,7 +5200,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5355,7 +5355,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5806,7 +5806,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -5976,7 +5976,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6131,7 +6131,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6349,7 +6349,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6451,7 +6451,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6553,7 +6553,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6655,7 +6655,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -6851,7 +6851,217 @@ This method can be significantly faster than the getAttribute()
Source:
+ + + + + + + + + + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + + + + +

hasAttribute(type, name, valueopt) → {boolean}

+ + + + + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + + + + + + +
name + + + + + + + +
value + + + + <optional>
+ + + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
@@ -7147,7 +7357,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7376,7 +7586,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7574,7 +7784,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7772,7 +7982,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -7970,7 +8180,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -8120,7 +8330,7 @@ This method can be significantly faster than the getAttribute()
Source:
@@ -9042,7 +9252,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -9222,7 +9432,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -9402,7 +9612,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -9597,7 +9807,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -9829,7 +10039,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -10009,7 +10219,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -10169,7 +10379,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -10411,7 +10621,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -10622,7 +10832,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -10833,7 +11043,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.html index ca0fb5b83..c8c829447 100644 --- a/docs/backend_api/NoteRevision.html +++ b/docs/backend_api/NoteRevision.html @@ -1448,7 +1448,7 @@ It's used for seamless note versioning.
Source:
@@ -1550,7 +1550,7 @@ It's used for seamless note versioning.
Source:
@@ -1830,7 +1830,7 @@ It's used for seamless note versioning.
Source:
diff --git a/docs/backend_api/becca_entities_note.js.html b/docs/backend_api/becca_entities_note.js.html index c73b7e304..b81585f36 100644 --- a/docs/backend_api/becca_entities_note.js.html +++ b/docs/backend_api/becca_entities_note.js.html @@ -477,6 +477,12 @@ class Note extends AbstractEntity { return this.inheritableAttributeCache; } + /** + * @param type + * @param name + * @param [value] + * @returns {boolean} + */ hasAttribute(type, name, value) { return !!this.getAttributes().find(attr => attr.type === type @@ -1277,7 +1283,7 @@ class Note extends AbstractEntity { ? this.dateModified : contentMetadata.dateModified, dateCreated: dateUtils.localNowDateTime() - }).save(); + }, true).save(); noteRevision.setContent(content); diff --git a/docs/backend_api/becca_entities_note_revision.js.html b/docs/backend_api/becca_entities_note_revision.js.html index a1f9ca729..f4062ef6c 100644 --- a/docs/backend_api/becca_entities_note_revision.js.html +++ b/docs/backend_api/becca_entities_note_revision.js.html @@ -47,7 +47,7 @@ class NoteRevision extends AbstractEntity { static get primaryKeyName() { return "noteRevisionId"; } static get hashedProperties() { return ["noteRevisionId", "noteId", "title", "isProtected", "dateLastEdited", "dateCreated", "utcDateLastEdited", "utcDateCreated", "utcDateModified"]; } - constructor(row) { + constructor(row, titleDecrypted = false) { super(); /** @type {string} */ @@ -75,13 +75,10 @@ class NoteRevision extends AbstractEntity { /** @type {number} */ this.contentLength = row.contentLength; - if (this.isProtected) { - if (protectedSessionService.isProtectedSessionAvailable()) { - this.title = protectedSessionService.decryptString(this.title); - } - else { - this.title = "[protected]"; - } + if (this.isProtected && !titleDecrypted) { + this.title = protectedSessionService.isProtectedSessionAvailable() + ? protectedSessionService.decryptString(this.title) + : "[protected]"; } } @@ -96,8 +93,8 @@ class NoteRevision extends AbstractEntity { /* * Note revision content has quite special handling - it's not a separate entity, but a lazily loaded - * part of NoteRevision entity with it's own sync. Reason behind this hybrid design is that - * content can be quite large and it's not necessary to load it / fill memory for any note access even + * part of NoteRevision entity with its own sync. Reason behind this hybrid design is that + * content can be quite large, and it's not necessary to load it / fill memory for any note access even * if we don't need a content, especially for bulk operations like search. * * This is the same approach as is used for Note's content. diff --git a/docs/frontend_api/Attribute.html b/docs/frontend_api/Attribute.html index 27344c376..34387fd67 100644 --- a/docs/frontend_api/Attribute.html +++ b/docs/frontend_api/Attribute.html @@ -727,6 +727,108 @@ and relation (representing named relationship between source and target note)(async) getTargetNote() → {Promise.<NoteShort>} + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise.<NoteShort> + + +
+
+ + + + + + + + diff --git a/docs/frontend_api/entities_attribute.js.html b/docs/frontend_api/entities_attribute.js.html index e43585495..72e9731b3 100644 --- a/docs/frontend_api/entities_attribute.js.html +++ b/docs/frontend_api/entities_attribute.js.html @@ -61,8 +61,19 @@ class Attribute { return this.froca.notes[this.noteId]; } + /** @returns {Promise<NoteShort>} */ + async getTargetNote() { + const targetNoteId = this.targetNoteId; + + return await this.froca.getNote(targetNoteId, true); + } + get targetNoteId() { // alias - return this.type === 'relation' ? this.value : undefined; + if (this.type !== 'relation') { + throw new Error(`Attribute ${this.attributeId} is not a relation`); + } + + return this.value; } get isAutoLink() { diff --git a/src/public/app/entities/attribute.js b/src/public/app/entities/attribute.js index 80f255d6c..094c5bfa8 100644 --- a/src/public/app/entities/attribute.js +++ b/src/public/app/entities/attribute.js @@ -33,8 +33,19 @@ class Attribute { return this.froca.notes[this.noteId]; } + /** @returns {Promise} */ + async getTargetNote() { + const targetNoteId = this.targetNoteId; + + return await this.froca.getNote(targetNoteId, true); + } + get targetNoteId() { // alias - return this.type === 'relation' ? this.value : undefined; + if (this.type !== 'relation') { + throw new Error(`Attribute ${this.attributeId} is not a relation`); + } + + return this.value; } get isAutoLink() {