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 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 13:06:48 +02:00
parent 88928b402f
commit 75323115fb
2 changed files with 17 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ function gateways() {
board: vi.fn(() => of([])), board: vi.fn(() => of([])),
issue: vi.fn(() => of(issue)), issue: vi.fn(() => of(issue)),
changeStatus: vi.fn(() => of(ok)), changeStatus: vi.fn(() => of(ok)),
watch: vi.fn(() => of(ok)),
}, },
list: { list: {
list: vi.fn(() => of([])), list: vi.fn(() => of([])),
@@ -233,6 +234,8 @@ describe('IssueFacade', () => {
status: 'QA_FAILED', status: 'QA_FAILED',
reason: 'Falla en Safari', 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', () => { it('uploads files one by one, and under a new comment when sent with it', () => {

View File

@@ -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 events
.on(issuePageEvents.linkRequested) .on(issuePageEvents.linkRequested)
.pipe( .pipe(