new functions and fixes
This commit is contained in:
@@ -165,9 +165,13 @@ function setNotesView(view) {
|
||||
});
|
||||
}
|
||||
function deleteButton(note, inline = false) {
|
||||
const disabled = note.protected;
|
||||
const disabled = !note.can_delete;
|
||||
const classes = `note-delete-button${inline ? " note-delete-button--inline" : ""}`;
|
||||
const reason = disabled ? "Protected notes cannot be deleted" : `Delete ${note.title}`;
|
||||
const reason = !disabled
|
||||
? `Delete ${note.title}`
|
||||
: note.protected
|
||||
? "Protected note: only its owner can delete it"
|
||||
: "Read-write access is required to delete this note";
|
||||
return `<button class="${classes}" data-delete-note="${escapeHtml(note.slug)}" data-note-title="${escapeHtml(note.title)}" ${disabled ? "disabled" : ""} title="${escapeHtml(reason)}">Delete</button>`;
|
||||
}
|
||||
function renderNotes(notes = notesCache) {
|
||||
|
||||
Reference in New Issue
Block a user