diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-11-27 16:02:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-27 16:02:18 +0000 |
| commit | 6821257def80ffa655b6feb893dd74ca2a13b9f1 (patch) | |
| tree | 34d02cefca4f9f4b69a07db268f7c1df289aa1fb /packages/trpc/models | |
| parent | 54268759492df88644e4279fdcc600214f922f43 (diff) | |
| download | karakeep-6821257def80ffa655b6feb893dd74ca2a13b9f1.tar.zst | |
fix: Propagate group ids in queue calls (#2177)
* fix: Propagate group ids
* fix tests
Diffstat (limited to 'packages/trpc/models')
| -rw-r--r-- | packages/trpc/models/bookmarks.ts | 17 | ||||
| -rw-r--r-- | packages/trpc/models/tags.ts | 14 |
2 files changed, 23 insertions, 8 deletions
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); |
