diff --git a/packages/core/content-manager/server/src/history/services/__tests__/history.test.ts b/packages/core/content-manager/server/src/history/services/__tests__/history.test.ts index 844158afa6..814763320f 100644 --- a/packages/core/content-manager/server/src/history/services/__tests__/history.test.ts +++ b/packages/core/content-manager/server/src/history/services/__tests__/history.test.ts @@ -124,7 +124,7 @@ describe('history-version service', () => { // Check that we don't break the middleware chain await historyMiddlewareFunction(context, next); - expect(next).toHaveBeenCalledWith(context); + expect(next).toHaveBeenCalled(); // Create and update actions should be saved in history expect(createMock).toHaveBeenCalled(); @@ -157,7 +157,7 @@ describe('history-version service', () => { // Don't break middleware chain even if we don't save the action in history next.mockClear(); await historyMiddlewareFunction(context, next); - expect(next).toHaveBeenCalledWith(context); + expect(next).toHaveBeenCalled(); }); it('should create a cron job that runs once a day', async () => { diff --git a/packages/core/content-manager/server/src/history/services/history.ts b/packages/core/content-manager/server/src/history/services/history.ts index 196a8567ce..24dd9e18eb 100644 --- a/packages/core/content-manager/server/src/history/services/history.ts +++ b/packages/core/content-manager/server/src/history/services/history.ts @@ -72,24 +72,24 @@ const createHistoryService = ({ strapi }: { strapi: Core.LoadedStrapi }) => { strapi.documents.use(async (context, next) => { // Ignore requests that are not related to the content manager if (!strapi.requestContext.get()?.request.url.startsWith('/content-manager')) { - return next(context); + return next(); } // Ignore actions that don't mutate documents if ( !['create', 'update', 'publish', 'unpublish', 'discardDraft'].includes(context.action) ) { - return next(context); + return next(); } // @ts-expect-error ContentType is not typed correctly on the context const contentTypeUid = context.contentType.uid; // Ignore content types not created by the user if (!contentTypeUid.startsWith('api::')) { - return next(context); + return next(); } - const result = (await next(context)) as any; + const result = (await next()) as any; const documentContext = context.action === 'create' diff --git a/packages/core/types/src/modules/documents/middleware.ts b/packages/core/types/src/modules/documents/middleware.ts index 047315ff2a..157af4dc98 100644 --- a/packages/core/types/src/modules/documents/middleware.ts +++ b/packages/core/types/src/modules/documents/middleware.ts @@ -13,5 +13,5 @@ export interface Context< export type Middleware = ( ctx: Context, - next: (ctx: Context) => ReturnType + next: () => ReturnType ) => ReturnType; diff --git a/packages/plugins/i18n/server/src/bootstrap.ts b/packages/plugins/i18n/server/src/bootstrap.ts index e4cd6e6243..38ce4e34f2 100644 --- a/packages/plugins/i18n/server/src/bootstrap.ts +++ b/packages/plugins/i18n/server/src/bootstrap.ts @@ -19,11 +19,11 @@ const registerModelsHooks = () => { const schema: Schema.ContentType = context.contentType; if (!['create', 'update', 'discardDraft', 'publish'].includes(context.action)) { - return next(context); + return next(); } if (!getService('content-types').isLocalizedContentType(schema)) { - return next(context); + return next(); } // Build a populate array for all non localized fields within the schema @@ -32,7 +32,7 @@ const registerModelsHooks = () => { const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(schema.uid); // Get the result of the document service action - const result = (await next(context)) as any; + const result = (await next()) as any; // We may not have received a result with everything populated that we need // Use the id and populate built from non localized fields to get the full