mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-28 18:42:28 +08:00
chore(client/ts): fix errors in attributes
This commit is contained in:
parent
8726cc62f3
commit
924453cb6f
@ -1,7 +1,8 @@
|
|||||||
import server from './server.js';
|
import server from './server.js';
|
||||||
import froca from './froca.js';
|
import froca from './froca.js';
|
||||||
|
import FNote from '../entities/fnote.js';
|
||||||
|
|
||||||
async function addLabel(noteId, name, value = "") {
|
async function addLabel(noteId: string, name: string, value: string = "") {
|
||||||
await server.put(`notes/${noteId}/attribute`, {
|
await server.put(`notes/${noteId}/attribute`, {
|
||||||
type: 'label',
|
type: 'label',
|
||||||
name: name,
|
name: name,
|
||||||
@ -9,7 +10,7 @@ async function addLabel(noteId, name, value = "") {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setLabel(noteId, name, value = "") {
|
async function setLabel(noteId: string, name: string, value: string = "") {
|
||||||
await server.put(`notes/${noteId}/set-attribute`, {
|
await server.put(`notes/${noteId}/set-attribute`, {
|
||||||
type: 'label',
|
type: 'label',
|
||||||
name: name,
|
name: name,
|
||||||
@ -17,7 +18,7 @@ async function setLabel(noteId, name, value = "") {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function removeAttributeById(noteId, attributeId) {
|
async function removeAttributeById(noteId: string, attributeId: string) {
|
||||||
await server.remove(`notes/${noteId}/attributes/${attributeId}`);
|
await server.remove(`notes/${noteId}/attributes/${attributeId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ async function removeAttributeById(noteId, attributeId) {
|
|||||||
* 2. attribute is owned by the template of the note
|
* 2. attribute is owned by the template of the note
|
||||||
* 3. attribute is owned by some note's ancestor and is inheritable
|
* 3. attribute is owned by some note's ancestor and is inheritable
|
||||||
*/
|
*/
|
||||||
function isAffecting(attrRow, affectedNote) {
|
function isAffecting(this: { isInheritable: boolean }, attrRow: { noteId: string }, affectedNote: FNote) {
|
||||||
if (!affectedNote || !attrRow) {
|
if (!affectedNote || !attrRow) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -48,6 +49,7 @@ function isAffecting(attrRow, affectedNote) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This doesn't seem right.
|
||||||
if (this.isInheritable) {
|
if (this.isInheritable) {
|
||||||
for (const owningNote of owningNotes) {
|
for (const owningNote of owningNotes) {
|
||||||
if (owningNote.hasAncestor(attrNote.noteId, true)) {
|
if (owningNote.hasAncestor(attrNote.noteId, true)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user