From 75323115fbc2b8bcb68e95d63268851d293f161f Mon Sep 17 00:00:00 2001 From: Josep Piguillem Date: Thu, 8 Oct 2026 13:06:48 +0200 Subject: [PATCH] fix: make the follow button on a ticket work The store never sent the follow and unfollow requests to the API. Co-Authored-By: Claude Opus 5.5 --- .../application/src/lib/facades/facades.spec.ts | 3 +++ .../application/src/lib/stores/issue.store.ts | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/libs/web/tracker/application/src/lib/facades/facades.spec.ts b/libs/web/tracker/application/src/lib/facades/facades.spec.ts index fc8b9d4..b001d6e 100644 --- a/libs/web/tracker/application/src/lib/facades/facades.spec.ts +++ b/libs/web/tracker/application/src/lib/facades/facades.spec.ts @@ -47,6 +47,7 @@ function gateways() { board: vi.fn(() => of([])), issue: vi.fn(() => of(issue)), changeStatus: vi.fn(() => of(ok)), + watch: vi.fn(() => of(ok)), }, list: { list: vi.fn(() => of([])), @@ -233,6 +234,8 @@ describe('IssueFacade', () => { status: 'QA_FAILED', reason: 'Falla en Safari', }); + issue.setWatching(true); + expect(fakes.issues.watch).toHaveBeenCalledWith('i1', true); }); it('uploads files one by one, and under a new comment when sent with it', () => { diff --git a/libs/web/tracker/application/src/lib/stores/issue.store.ts b/libs/web/tracker/application/src/lib/stores/issue.store.ts index 09fb1d4..f208c2d 100644 --- a/libs/web/tracker/application/src/lib/stores/issue.store.ts +++ b/libs/web/tracker/application/src/lib/stores/issue.store.ts @@ -228,6 +228,20 @@ export const IssueStore = signalStore( ), ), ), + events + .on(issuePageEvents.watchRequested) + .pipe( + mergeMap(({ payload }) => + runCommand( + issues.watch(payload.issueId, payload.watching), + payload.watching + ? 'Ahora sigues este ticket' + : 'Has dejado de seguir este ticket', + done, + failed, + ), + ), + ), events .on(issuePageEvents.linkRequested) .pipe(