From 6821257def80ffa655b6feb893dd74ca2a13b9f1 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Thu, 27 Nov 2025 16:02:18 +0000 Subject: fix: Propagate group ids in queue calls (#2177) * fix: Propagate group ids * fix tests --- packages/trpc/models/bookmarks.ts | 17 ++++++++++++----- packages/trpc/models/tags.ts | 14 +++++++++++--- 2 files changed, 23 insertions(+), 8 deletions(-) (limited to 'packages/trpc/models') diff --git a/packages/trpc/models/bookmarks.ts b/packages/trpc/models/bookmarks.ts index bd696ee8..07fa8693 100644 --- a/packages/trpc/models/bookmarks.ts +++ b/packages/trpc/models/bookmarks.ts @@ -779,12 +779,19 @@ export class Bookmark extends BareBookmark { ), ); - await SearchIndexingQueue.enqueue({ - bookmarkId: this.bookmark.id, - type: "delete", - }); + await SearchIndexingQueue.enqueue( + { + bookmarkId: this.bookmark.id, + type: "delete", + }, + { + groupId: this.ctx.user.id, + }, + ); - await triggerWebhook(this.bookmark.id, "deleted", this.ctx.user.id); + await triggerWebhook(this.bookmark.id, "deleted", this.ctx.user.id, { + groupId: this.ctx.user.id, + }); if (deleted.changes > 0) { await this.cleanupAssets(); } diff --git a/packages/trpc/models/tags.ts b/packages/trpc/models/tags.ts index b230b6b4..55532077 100644 --- a/packages/trpc/models/tags.ts +++ b/packages/trpc/models/tags.ts @@ -280,7 +280,11 @@ export class Tag { try { await Promise.all( - affectedBookmarks.map((id) => triggerSearchReindex(id)), + affectedBookmarks.map((id) => + triggerSearchReindex(id, { + groupId: ctx.user.id, + }), + ), ); } catch (e) { console.error("Failed to reindex affected bookmarks", e); @@ -315,7 +319,9 @@ export class Tag { await Promise.all( affectedBookmarks.map(({ bookmarkId }) => - triggerSearchReindex(bookmarkId), + triggerSearchReindex(bookmarkId, { + groupId: this.ctx.user.id, + }), ), ); } @@ -352,7 +358,9 @@ export class Tag { await Promise.all( affectedBookmarks .map((b) => b.bookmarkId) - .map((id) => triggerSearchReindex(id)), + .map((id) => + triggerSearchReindex(id, { groupId: this.ctx.user.id }), + ), ); } catch (e) { console.error("Failed to reindex affected bookmarks", e); -- cgit v1.2.3-70-g09d2