diff --git a/src/public/app/components/note_context.js b/src/public/app/components/note_context.js
index de39313e4..9116304b2 100644
--- a/src/public/app/components/note_context.js
+++ b/src/public/app/components/note_context.js
@@ -241,9 +241,9 @@ class NoteContext extends Component {
async entitiesReloadedEvent({loadResults}) {
if (loadResults.isNoteReloaded(this.noteId)) {
- const note = loadResults.getEntityRow('notes', this.noteId);
+ const noteRow = loadResults.getEntityRow('notes', this.noteId);
- if (note.isDeleted) {
+ if (noteRow.isDeleted) {
this.noteId = null;
this.notePath = null;
diff --git a/src/public/app/components/shortcut_component.js b/src/public/app/components/shortcut_component.js
index dfe0dde36..f19a71885 100644
--- a/src/public/app/components/shortcut_component.js
+++ b/src/public/app/components/shortcut_component.js
@@ -15,14 +15,14 @@ export default class ShortcutComponent extends Component {
});
}
- bindNoteShortcutHandler(label) {
- const handler = () => appContext.tabManager.getActiveContext().setNote(label.noteId);
- const namespace = label.attributeId;
+ bindNoteShortcutHandler(labelOrRow) {
+ const handler = () => appContext.tabManager.getActiveContext().setNote(labelOrRow.noteId);
+ const namespace = labelOrRow.attributeId;
- if (label.isDeleted) {
+ if (labelOrRow.isDeleted) { // only applicable if row
shortcutService.removeGlobalShortcut(namespace);
} else {
- shortcutService.bindGlobalShortcut(label.value, handler, namespace);
+ shortcutService.bindGlobalShortcut(labelOrRow.value, handler, namespace);
}
}
diff --git a/src/public/app/services/load_results.js b/src/public/app/services/load_results.js
index af36f7d8e..0b1bb7625 100644
--- a/src/public/app/services/load_results.js
+++ b/src/public/app/services/load_results.js
@@ -67,7 +67,6 @@ export default class LoadResults {
this.attributeRows.push({attributeId, componentId});
}
- /** @returns {FAttribute[]} */
getAttributeRows(componentId = 'none') {
return this.attributeRows
.filter(row => row.componentId !== componentId)
diff --git a/src/public/app/services/note_tooltip.js b/src/public/app/services/note_tooltip.js
index df6530ed9..e8708f273 100644
--- a/src/public/app/services/note_tooltip.js
+++ b/src/public/app/services/note_tooltip.js
@@ -75,7 +75,7 @@ function mouseLeaveHandler() {
}
async function renderTooltip(note) {
- if (note.isDeleted) {
+ if (!note) {
return '
Note has been deleted.
';
}
diff --git a/src/public/app/widgets/attachment_detail.js b/src/public/app/widgets/attachment_detail.js
index 8b8c60d28..7d1c564a0 100644
--- a/src/public/app/widgets/attachment_detail.js
+++ b/src/public/app/widgets/attachment_detail.js
@@ -191,10 +191,10 @@ export default class AttachmentDetailWidget extends BasicWidget {
}
async entitiesReloadedEvent({loadResults}) {
- const attachmentChange = loadResults.getAttachmentRows().find(att => att.attachmentId === this.attachment.attachmentId);
+ const attachmentRow = loadResults.getAttachmentRows().find(att => att.attachmentId === this.attachment.attachmentId);
- if (attachmentChange) {
- if (attachmentChange.isDeleted) {
+ if (attachmentRow) {
+ if (attachmentRow.isDeleted) {
this.toggleInt(false);
} else {
this.refresh();
diff --git a/src/public/app/widgets/attribute_widgets/attribute_editor.js b/src/public/app/widgets/attribute_widgets/attribute_editor.js
index cef05b895..e8f55523f 100644
--- a/src/public/app/widgets/attribute_widgets/attribute_editor.js
+++ b/src/public/app/widgets/attribute_widgets/attribute_editor.js
@@ -460,14 +460,7 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
const {noteId} = linkService.parseNavigationStateFromUrl($el.find("a").attr("href"));
const note = await froca.getNote(noteId, true);
- let title;
-
- if (!note) {
- title = '[missing]';
- }
- else {
- title = note.isDeleted ? `${note.title} (deleted)` : note.title;
- }
+ const title = note ? note.title : '[missing]';
$el.text(title);
}
@@ -477,7 +470,6 @@ export default class AttributeEditorWidget extends NoteContextAwareWidget {
}
async renderOwnedAttributes(ownedAttributes, saved) {
- ownedAttributes = ownedAttributes.filter(oa => !oa.isDeleted);
// attrs are not resorted if position changes after initial load
ownedAttributes.sort((a, b) => a.position < b.position ? -1 : 1);
diff --git a/src/public/app/widgets/buttons/launcher/abstract_launcher.js b/src/public/app/widgets/buttons/launcher/abstract_launcher.js
index 87bfbd6d0..3e9cd1f6d 100644
--- a/src/public/app/widgets/buttons/launcher/abstract_launcher.js
+++ b/src/public/app/widgets/buttons/launcher/abstract_launcher.js
@@ -20,13 +20,13 @@ export default class AbstractLauncher extends OnClickButtonWidget {
throw new Error("Abstract implementation");
}
- bindNoteShortcutHandler(label) {
- const namespace = label.attributeId;
+ bindNoteShortcutHandler(labelOrRow) {
+ const namespace = labelOrRow.attributeId;
- if (label.isDeleted) {
+ if (labelOrRow.isDeleted) { // only applicable if row
shortcutService.removeGlobalShortcut(namespace);
} else {
- shortcutService.bindGlobalShortcut(label.value, () => this.launch(), namespace);
+ shortcutService.bindGlobalShortcut(labelOrRow.value, () => this.launch(), namespace);
}
}
diff --git a/src/public/app/widgets/dialogs/bulk_actions.js b/src/public/app/widgets/dialogs/bulk_actions.js
index 6e635b050..5c74ce62d 100644
--- a/src/public/app/widgets/dialogs/bulk_actions.js
+++ b/src/public/app/widgets/dialogs/bulk_actions.js
@@ -147,11 +147,11 @@ export default class BulkActionsDialog extends BasicWidget {
entitiesReloadedEvent({loadResults}) {
// only refreshing deleted attrs, otherwise components update themselves
- if (loadResults.getAttributeRows().find(attr =>
- attr.type === 'label'
- && attr.name === 'action'
- && attr.noteId === '_bulkAction'
- && attr.isDeleted)) {
+ if (loadResults.getAttributeRows().find(row =>
+ row.type === 'label'
+ && row.name === 'action'
+ && row.noteId === '_bulkAction'
+ && row.isDeleted)) {
// this may be triggered from e.g. sync without open widget, then no need to refresh the widget
if (this.selectedOrActiveNoteIds && this.$widget.is(":visible")) {
diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.js
index 433393330..4bbffa073 100644
--- a/src/public/app/widgets/note_detail.js
+++ b/src/public/app/widgets/note_detail.js
@@ -19,7 +19,6 @@ import RelationMapTypeWidget from "./type_widgets/relation_map.js";
import CanvasTypeWidget from "./type_widgets/canvas.js";
import ProtectedSessionTypeWidget from "./type_widgets/protected_session.js";
import BookTypeWidget from "./type_widgets/book.js";
-import DeletedTypeWidget from "./type_widgets/deleted.js";
import ReadOnlyTextTypeWidget from "./type_widgets/read_only_text.js";
import ReadOnlyCodeTypeWidget from "./type_widgets/read_only_code.js";
import NoneTypeWidget from "./type_widgets/none.js";
@@ -47,7 +46,6 @@ const TPL = `
const typeWidgetClasses = {
'empty': EmptyTypeWidget,
- 'deleted': DeletedTypeWidget,
'editableText': EditableTextTypeWidget,
'readOnlyText': ReadOnlyTextTypeWidget,
'editableCode': EditableCodeTypeWidget,
@@ -189,8 +187,6 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
if (!note) {
return "empty";
- } else if (note.isDeleted) {
- return "deleted";
}
let type = note.type;
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js
index 5d3c6ede8..e2e3c157f 100644
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@ -526,7 +526,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const note = await froca.getNote(node.data.noteId, true);
- if (!note || note.isDeleted) {
+ if (!note) {
return;
}
@@ -984,10 +984,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
oldActiveNode.setFocus(false);
}
- if (this.noteContext
- && this.noteContext.notePath
- && !this.noteContext.note?.isDeleted
- && (!treeService.isNotePathInHiddenSubtree(this.noteContext.notePath) || await hoistedNoteService.isHoistedInHiddenSubtree())
+ if (this.noteContext?.notePath
+ && (
+ !treeService.isNotePathInHiddenSubtree(this.noteContext.notePath)
+ || await hoistedNoteService.isHoistedInHiddenSubtree()
+ )
) {
const newActiveNode = await this.getNodeFromPath(this.noteContext.notePath);
@@ -1125,20 +1126,20 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
let parentsOfAddedNodes = [];
const allBranchRows = loadResults.getBranchRows();
- const allBranchesDeleted = allBranchRows.every(branch => !!branch.isDeleted);
+ const allBranchesDeleted = allBranchRows.every(branchRow => !!branchRow.isDeleted);
- for (const ecBranch of allBranchRows) {
- if (ecBranch.parentNoteId === '_share') {
+ for (const branchRow of allBranchRows) {
+ if (branchRow.parentNoteId === '_share') {
// all shared notes have a sign in the tree, even the descendants of shared notes
- noteIdsToReload.add(ecBranch.noteId);
+ noteIdsToReload.add(branchRow.noteId);
}
else {
// adding noteId itself to update all potential clones
- noteIdsToUpdate.add(ecBranch.noteId);
+ noteIdsToUpdate.add(branchRow.noteId);
}
- for (const node of this.getNodesByBranch(ecBranch)) {
- if (ecBranch.isDeleted) {
+ for (const node of this.getNodesByBranch(branchRow)) {
+ if (branchRow.isDeleted) {
if (node.isActive()) {
if (allBranchesDeleted) {
const newActiveNode = node.getNextSibling()
@@ -1157,23 +1158,23 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
node.remove();
}
- noteIdsToUpdate.add(ecBranch.parentNoteId);
+ noteIdsToUpdate.add(branchRow.parentNoteId);
}
}
- if (!ecBranch.isDeleted) {
- for (const parentNode of this.getNodesByNoteId(ecBranch.parentNoteId)) {
+ if (!branchRow.isDeleted) {
+ for (const parentNode of this.getNodesByNoteId(branchRow.parentNoteId)) {
parentsOfAddedNodes.push(parentNode)
if (parentNode.isFolder() && !parentNode.isLoaded()) {
continue;
}
- const found = (parentNode.getChildren() || []).find(child => child.data.noteId === ecBranch.noteId);
+ const found = (parentNode.getChildren() || []).find(child => child.data.noteId === branchRow.noteId);
if (!found) {
// make sure it's loaded
- await froca.getNote(ecBranch.noteId);
- const frocaBranch = froca.getBranch(ecBranch.branchId);
+ await froca.getNote(branchRow.noteId);
+ const frocaBranch = froca.getBranch(branchRow.branchId);
// we're forcing lazy since it's not clear if the whole required subtree is in froca
parentNode.addChildren([this.prepareNode(frocaBranch, true)]);
@@ -1181,7 +1182,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
this.sortChildren(parentNode);
// this might be a first child which would force an icon change
- noteIdsToUpdate.add(ecBranch.parentNoteId);
+ noteIdsToUpdate.add(branchRow.parentNoteId);
}
}
}
diff --git a/src/public/app/widgets/ribbon_widgets/search_definition.js b/src/public/app/widgets/ribbon_widgets/search_definition.js
index d30484bc6..5d2afec4b 100644
--- a/src/public/app/widgets/ribbon_widgets/search_definition.js
+++ b/src/public/app/widgets/ribbon_widgets/search_definition.js
@@ -312,7 +312,9 @@ export default class SearchDefinitionWidget extends NoteContextAwareWidget {
entitiesReloadedEvent({loadResults}) {
// only refreshing deleted attrs, otherwise components update themselves
- if (loadResults.getAttributeRows().find(attr => attr.type === 'label' && attr.name === 'action' && attr.isDeleted)) {
+ if (loadResults.getAttributeRows().find(attrRow =>
+ attrRow.type === 'label' && attrRow.name === 'action' && attrRow.isDeleted)) {
+
this.refresh();
}
}
diff --git a/src/public/app/widgets/type_widgets/attachment_detail.js b/src/public/app/widgets/type_widgets/attachment_detail.js
index 95efd5fdd..f3636176b 100644
--- a/src/public/app/widgets/type_widgets/attachment_detail.js
+++ b/src/public/app/widgets/type_widgets/attachment_detail.js
@@ -72,9 +72,9 @@ export default class AttachmentDetailTypeWidget extends TypeWidget {
}
async entitiesReloadedEvent({loadResults}) {
- const attachmentChange = loadResults.getAttachmentRows().find(att => att.attachmentId === this.attachmentId);
+ const attachmentRow = loadResults.getAttachmentRows().find(att => att.attachmentId === this.attachmentId);
- if (attachmentChange?.isDeleted) {
+ if (attachmentRow?.isDeleted) {
this.refresh(); // all other updates are handled within AttachmentDetailWidget
}
}
diff --git a/src/public/app/widgets/type_widgets/deleted.js b/src/public/app/widgets/type_widgets/deleted.js
deleted file mode 100644
index 955fd2893..000000000
--- a/src/public/app/widgets/type_widgets/deleted.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import TypeWidget from "./type_widget.js";
-
-const TPL = `
-
-
-
- This note has been deleted.
-
-
-
`;
-
-export default class DeletedTypeWidget extends TypeWidget {
- static getType() { return "deleted"; }
-
- doRender() {
- this.$widget = $(TPL);
-
- super.doRender();
- }
-}