From fc261a0a957319599342575dd31f1695ec5bd7dd Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Sat, 10 Oct 2026 19:15:54 -0400 Subject: [PATCH] refactor(share): retire trashed shares through onEntryOwnerChanged onEntryTrashed was a copy of onEntryOwnerChanged: the same subtree share sweep, grant retire and row delete. --- src/backend/services/share/ShareService.ts | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/backend/services/share/ShareService.ts b/src/backend/services/share/ShareService.ts index 134291a65..eb8ea3776 100644 --- a/src/backend/services/share/ShareService.ts +++ b/src/backend/services/share/ShareService.ts @@ -1867,22 +1867,9 @@ export class ShareService extends PuterService { * invites go with them, and a restore does not bring any of it back. */ async onEntryTrashed(entry: FSEntry): Promise { - // Every kind of row, since a link share deeper in the subtree grants - // access on its own, without a grant or an index row above it. - const rows = await this.stores.share.listAllByFsentrySubtree(entry.id); - const fsentryIds = [ - ...new Set([ - entry.id, - ...rows.map((row: { fsentry_id: number }) => - Number(row.fsentry_id), - ), - ]), - ].filter((id) => Number.isFinite(id)); - - const nodes = await this.stores.fsEntry.getEntriesByIds(fsentryIds); - const uuids = [...nodes.values()].map((node) => node.uuid); - if (uuids.length > 0) await this.onEntryDeleted(uuids); - await this.stores.share.deleteByFsentryIds(fsentryIds); + // The same sweep as a change of owner: every kind of row in the + // subtree, since a link share deeper down grants access on its own. + await this.onEntryOwnerChanged(entry); } // -- Reads --------------------------------------------------------