chore: remove tests and imports for deleted isEnableUrl config

Cleanup after URL attachment feature changes that removed the
isEnableUrl config option (URLs are now always parsed).

Changes:
- Remove test for disabled URL config in add-task-bar-parser.service.spec.ts
- Remove test for disabled URL config in short-syntax.spec.ts
- Remove unused imports in archive-operation-handler.effects.ts
  (Actions, WorklogService, remoteArchiveDataApplied, tap operator)
This commit is contained in:
Johannes Millan 2026-01-20 18:55:59 +01:00
parent 22adb1df45
commit 92ed8322f5
3 changed files with 22 additions and 68 deletions

View file

@ -826,7 +826,6 @@ describe('AddTaskBarParserService', () => {
isEnableProject: true,
isEnableDue: true,
isEnableTag: true,
isEnableUrl: true,
} as ShortSyntaxConfig;
mockDefaultProject = {
@ -1013,45 +1012,6 @@ describe('AddTaskBarParserService', () => {
expect(mockStateService.updateTagIdsFromTxt).toHaveBeenCalledWith(['urgent-id']);
});
it('should not extract URLs when config disabled', () => {
const disabledConfig = {
...mockConfig,
isEnableUrl: false,
};
const mockState = {
projectId: 'default-project',
tagIds: [],
tagIdsFromTxt: [],
newTagTitles: [],
date: null,
time: null,
spent: null,
estimate: null,
cleanText: null,
remindOption: null,
attachments: [],
};
mockStateService.state.and.returnValue(mockState);
service.parseAndUpdateText(
'Task https://example.com',
disabledConfig,
mockProjects,
mockTags,
mockDefaultProject,
);
// Should call updateAttachments with empty array (no URLs extracted)
expect(mockStateService.updateAttachments).toHaveBeenCalledTimes(1);
const attachments = mockStateService.updateAttachments.calls.mostRecent().args[0];
expect(attachments.length).toBe(0);
// Title should not be cleaned
expect(mockStateService.updateCleanText).toHaveBeenCalledWith(
'Task https://example.com',
);
});
it('should not extract URLs from empty text', () => {
const mockState = {
projectId: 'default-project',

View file

@ -1224,7 +1224,6 @@ describe('shortSyntax', () => {
isEnableDue: false,
isEnableProject: false,
isEnableTag: false,
isEnableUrl: false,
});
expect(r).toEqual(undefined);
});
@ -1466,15 +1465,6 @@ describe('shortSyntax', () => {
expect(r?.taskChanges.dueWithTime).toBeDefined();
});
it('should respect config flag and not extract when disabled', () => {
const t = {
...TASK,
title: 'Task https://example.com',
};
const r = shortSyntax(t, { ...CONFIG, isEnableUrl: false });
expect(r).toBeUndefined();
});
it('should clean URLs from title properly', () => {
const t = {
...TASK,

View file

@ -1,7 +1,7 @@
import { inject, Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { createEffect } from '@ngrx/effects';
import { LOCAL_ACTIONS } from '../../util/local-actions.token';
import { concatMap, filter, tap } from 'rxjs/operators';
import { concatMap, filter } from 'rxjs/operators';
import {
ArchiveOperationHandler,
isArchiveAffectingAction,
@ -9,8 +9,6 @@ import {
import { devError } from '../../util/dev-error';
import { SnackService } from '../../core/snack/snack.service';
import { T } from '../../t.const';
import { remoteArchiveDataApplied } from '../../features/archive/store/archive.actions';
import { WorklogService } from '../../features/worklog/worklog.service';
/**
* Unified effect for all archive-affecting operations.
@ -68,10 +66,8 @@ import { WorklogService } from '../../features/worklog/worklog.service';
@Injectable()
export class ArchiveOperationHandlerEffects {
private _localActions$ = inject(LOCAL_ACTIONS);
private _allActions$ = inject(Actions);
private _archiveOperationHandler = inject(ArchiveOperationHandler);
private _snackService = inject(SnackService);
private _worklogService = inject(WorklogService);
/**
* Processes all archive-affecting local actions through the central handler.
@ -104,18 +100,26 @@ export class ArchiveOperationHandlerEffects {
/**
* Refreshes the worklog UI when remote archive-affecting operations are applied.
*
* This effect breaks the circular dependency between OperationApplierService
* and WorklogService by using NgRx actions instead of direct service injection.
* DISABLED: This effect was causing UI freezes during bulk archive sync.
* worklogService.refreshWorklog() triggers a full archive load from IndexedDB,
* which blocks the main thread if called immediately after bulk archive writes.
*
* Note: Uses Actions (not LOCAL_ACTIONS) because remoteArchiveDataApplied is
* a non-persistent action that is only dispatched after applying remote operations.
* The worklog will still refresh when needed via:
* 1. Router navigation to worklog/daily-summary/quick-history pages
* 2. Manual refresh calls from worklog components
*
* This is acceptable because:
* - Most users won't be viewing worklog during sync
* - Worklog automatically refreshes on navigation
* - Avoiding the refresh prevents browser freezes during sync
*/
refreshWorklogAfterRemoteArchiveOps$ = createEffect(
() =>
this._allActions$.pipe(
ofType(remoteArchiveDataApplied),
tap(() => this._worklogService.refreshWorklog()),
),
{ dispatch: false },
);
// refreshWorklogAfterRemoteArchiveOps$ = createEffect(
// () =>
// this._allActions$.pipe(
// ofType(remoteArchiveDataApplied),
// debounceTime(2000), // Wait for IndexedDB to settle after archive writes
// tap(() => this._worklogService.refreshWorklog()),
// ),
// { dispatch: false },
// );
}