Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: delete linked inboxHistoryItem's on permanent note deletion Signed-off-by: 01zulfi <[email protected]>

01zulfifc244b119645
diff --git a/apps/mobile/app/screens/settings/failed-inbox-items.tsx b/apps/mobile/app/screens/settings/failed-inbox-items.tsx
index d5d97c8da..7ae69c95b 100644
--- a/apps/mobile/app/screens/settings/failed-inbox-items.tsx
+++ b/apps/mobile/app/screens/settings/failed-inbox-items.tsx
@@ -168,7 +168,7 @@ export const FailedInboxItems = () => {
const result = usePromise(() => db.inboxItemsHistory.failed.items());
async function deleteItem(id: string) {
- await db.inboxItemsHistory.delete(id);
+ await db.inboxItemsHistory.delete([id]);
ToastManager.show({
message: strings.itemDeleted(),
type: "success"
diff --git a/apps/web/src/dialogs/inbox-history-dialog.tsx b/apps/web/src/dialogs/inbox-history-dialog.tsx
index c36f96626..9affb00c7 100644
--- a/apps/web/src/dialogs/inbox-history-dialog.tsx
+++ b/apps/web/src/dialogs/inbox-history-dialog.tsx
@@ -152,7 +152,7 @@ export const InboxHistoryDialog = DialogManager.register(
const result = usePromise(() => db.inboxItemsHistory.failed.items());
async function deleteItem(id: string) {
- await db.inboxItemsHistory.delete(id);
+ await db.inboxItemsHistory.delete([id]);
showToast("success", strings.itemDeleted());
if (result.status !== "pending") {
result.refresh();
diff --git a/packages/core/src/collections/inbox-items-history.ts b/packages/core/src/collections/inbox-items-history.ts
index 9d72c3b5a..a4b45fb66 100644
--- a/packages/core/src/collections/inbox-items-history.ts
+++ b/packages/core/src/collections/inbox-items-history.ts
@@ -67,8 +67,8 @@ export class InboxItemsHistory implements ICollection {
);
}
- async delete(id: string) {
- await this.collection.softDelete([id]);
+ async delete(ids: string[]) {
+ await this.collection.softDelete(ids);
}
async deleteFailed() {
diff --git a/packages/core/src/collections/notes.ts b/packages/core/src/collections/notes.ts
index f546d2a04..a06a49cc7 100644
--- a/packages/core/src/collections/notes.ts
+++ b/packages/core/src/collections/notes.ts
@@ -489,6 +489,7 @@ export class Notes implements ICollection {
await this.db.relations.unlinkOfType("note", ids);
await this.collection.softDelete(ids);
await this.db.content.removeByNoteId(...ids);
+ await this.db.inboxItemsHistory.delete(ids);
});
}