diff --git a/src/app/core/persistence/operation-log/processing/archive-operation-handler.service.spec.ts b/src/app/core/persistence/operation-log/processing/archive-operation-handler.service.spec.ts index 12da1646f1..b0bfb5fd5d 100644 --- a/src/app/core/persistence/operation-log/processing/archive-operation-handler.service.spec.ts +++ b/src/app/core/persistence/operation-log/processing/archive-operation-handler.service.spec.ts @@ -13,7 +13,6 @@ import { TaskSharedActions } from '../../../../root-store/meta/task-shared.actio import { flushYoungToOld } from '../../../../features/time-tracking/store/archive.actions'; import { deleteTag, deleteTags } from '../../../../features/tag/store/tag.actions'; import { TimeTrackingService } from '../../../../features/time-tracking/time-tracking.service'; -import { IssueProviderActions } from '../../../../features/issue/store/issue-provider.actions'; describe('isArchiveAffectingAction', () => { it('should return true for moveToArchive action', () => { @@ -57,7 +56,7 @@ describe('isArchiveAffectingAction', () => { }); it('should return true for deleteIssueProviders action', () => { - const action = { type: IssueProviderActions.deleteIssueProviders.type }; + const action = { type: TaskSharedActions.deleteIssueProviders.type }; expect(isArchiveAffectingAction(action)).toBe(true); }); @@ -493,7 +492,7 @@ describe('ArchiveOperationHandler', () => { describe('deleteIssueProviders action', () => { it('should unlink multiple issue providers from all archive tasks', async () => { const action = { - type: IssueProviderActions.deleteIssueProviders.type, + type: TaskSharedActions.deleteIssueProviders.type, ids: ['provider-1', 'provider-2', 'provider-3'], meta: { isPersistent: true, isRemote: true }, } as unknown as PersistentAction; @@ -516,7 +515,7 @@ describe('ArchiveOperationHandler', () => { it('should not call other handlers for deleteIssueProviders', async () => { const action = { - type: IssueProviderActions.deleteIssueProviders.type, + type: TaskSharedActions.deleteIssueProviders.type, ids: ['provider-1'], meta: { isPersistent: true, isRemote: true }, } as unknown as PersistentAction; @@ -727,7 +726,7 @@ describe('ArchiveOperationHandler', () => { ); const action = { - type: IssueProviderActions.deleteIssueProviders.type, + type: TaskSharedActions.deleteIssueProviders.type, ids: ['provider-1', 'provider-2'], meta: { isPersistent: true, isRemote: true }, } as unknown as PersistentAction; diff --git a/src/app/core/persistence/operation-log/processing/archive-operation-handler.service.ts b/src/app/core/persistence/operation-log/processing/archive-operation-handler.service.ts index 1f286b8045..96bbf3ced8 100644 --- a/src/app/core/persistence/operation-log/processing/archive-operation-handler.service.ts +++ b/src/app/core/persistence/operation-log/processing/archive-operation-handler.service.ts @@ -12,7 +12,6 @@ import { Log } from '../../../log'; import { lazyInject } from '../../../../util/lazy-inject'; import { deleteTag, deleteTags } from '../../../../features/tag/store/tag.actions'; import { TimeTrackingService } from '../../../../features/time-tracking/time-tracking.service'; -import { IssueProviderActions } from '../../../../features/issue/store/issue-provider.actions'; /** * Action types that affect archive storage and require special handling. @@ -26,7 +25,7 @@ const ARCHIVE_AFFECTING_ACTION_TYPES: string[] = [ deleteTags.type, TaskSharedActions.deleteTaskRepeatCfg.type, TaskSharedActions.deleteIssueProvider.type, - IssueProviderActions.deleteIssueProviders.type, + TaskSharedActions.deleteIssueProviders.type, ]; /** @@ -130,7 +129,7 @@ export class ArchiveOperationHandler { await this._handleDeleteIssueProvider(action); break; - case IssueProviderActions.deleteIssueProviders.type: + case TaskSharedActions.deleteIssueProviders.type: await this._handleDeleteIssueProviders(action); break; } @@ -269,8 +268,7 @@ export class ArchiveOperationHandler { * Called when receiving a remote deleteIssueProviders operation. */ private async _handleDeleteIssueProviders(action: PersistentAction): Promise { - const ids = (action as ReturnType) - .ids; + const ids = (action as ReturnType).ids; for (const issueProviderId of ids) { await this._getTaskArchiveService().unlinkIssueProviderFromArchiveTasks( issueProviderId, diff --git a/src/app/features/issue/store/issue-provider.actions.ts b/src/app/features/issue/store/issue-provider.actions.ts index 619549aadf..90f49aaec3 100644 --- a/src/app/features/issue/store/issue-provider.actions.ts +++ b/src/app/features/issue/store/issue-provider.actions.ts @@ -57,27 +57,6 @@ export const IssueProviderActions = createActionGroup({ } satisfies PersistentActionMeta, }), - 'Delete IssueProvider': (providerProps: { id: string }) => ({ - ...providerProps, - meta: { - isPersistent: true, - entityType: 'ISSUE_PROVIDER', - entityId: providerProps.id, - opType: OpType.Delete, - } satisfies PersistentActionMeta, - }), - - 'Delete IssueProviders': (providerProps: { ids: string[] }) => ({ - ...providerProps, - meta: { - isPersistent: true, - entityType: 'ISSUE_PROVIDER', - entityIds: providerProps.ids, - opType: OpType.Delete, - isBulk: true, - } satisfies PersistentActionMeta, - }), - // Internal cleanup action - no persistence 'Clear IssueProviders': emptyProps(), }, diff --git a/src/app/features/issue/store/issue-provider.reducer.ts b/src/app/features/issue/store/issue-provider.reducer.ts index 46a953ce4b..bd573911f4 100644 --- a/src/app/features/issue/store/issue-provider.reducer.ts +++ b/src/app/features/issue/store/issue-provider.reducer.ts @@ -34,6 +34,9 @@ export const issueProviderReducer = createReducer( on(TaskSharedActions.deleteIssueProvider, (state, { issueProviderId }) => adapter.removeOne(issueProviderId, state), ), + on(TaskSharedActions.deleteIssueProviders, (state, { ids }) => + adapter.removeMany(ids, state), + ), // ----------- on(IssueProviderActions.addIssueProvider, (state, action) => @@ -54,12 +57,6 @@ export const issueProviderReducer = createReducer( on(IssueProviderActions.updateIssueProviders, (state, action) => adapter.updateMany(action.issueProviders, state), ), - on(IssueProviderActions.deleteIssueProvider, (state, action) => - adapter.removeOne(action.id, state), - ), - on(IssueProviderActions.deleteIssueProviders, (state, action) => - adapter.removeMany(action.ids, state), - ), on(IssueProviderActions.loadIssueProviders, (state, action) => adapter.setAll(action.issueProviders, state), ), diff --git a/src/app/root-store/meta/task-shared-meta-reducers/issue-provider-shared.reducer.ts b/src/app/root-store/meta/task-shared-meta-reducers/issue-provider-shared.reducer.ts index 0ebd2d1cb6..5cb66ae5e3 100644 --- a/src/app/root-store/meta/task-shared-meta-reducers/issue-provider-shared.reducer.ts +++ b/src/app/root-store/meta/task-shared-meta-reducers/issue-provider-shared.reducer.ts @@ -63,6 +63,12 @@ const createActionHandlers = (state: RootState, action: Action): ActionHandlerMa >; return handleDeleteIssueProvider(state, taskIdsToUnlink); }, + [TaskSharedActions.deleteIssueProviders.type]: () => { + const { taskIdsToUnlink } = action as ReturnType< + typeof TaskSharedActions.deleteIssueProviders + >; + return handleDeleteIssueProvider(state, taskIdsToUnlink); + }, }); export const issueProviderSharedMetaReducer: MetaReducer = ( diff --git a/src/app/root-store/meta/task-shared.actions.ts b/src/app/root-store/meta/task-shared.actions.ts index 44b349c9af..4358061d85 100644 --- a/src/app/root-store/meta/task-shared.actions.ts +++ b/src/app/root-store/meta/task-shared.actions.ts @@ -279,6 +279,17 @@ export const TaskSharedActions = createActionGroup({ } satisfies PersistentActionMeta, }), + deleteIssueProviders: (props: { ids: string[]; taskIdsToUnlink: string[] }) => ({ + ...props, + meta: { + isPersistent: true, + entityType: 'ISSUE_PROVIDER', + entityIds: props.ids, + opType: OpType.Delete, + isBulk: true, + } satisfies PersistentActionMeta, + }), + // Task Repeat Config Management deleteTaskRepeatCfg: (props: { taskRepeatCfgId: string;