mirror of
https://github.com/strapi/strapi.git
synced 2025-11-15 17:49:57 +00:00
chore: merge fixes
chore: fix lint
This commit is contained in:
parent
0654f395cd
commit
9a537e811b
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
|
||||||
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
||||||
import { act, renderHook } from '@testing-library/react';
|
import { act, renderHook } from '@testing-library/react';
|
||||||
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
|
|
||||||
import useSelect from '../select';
|
import useSelect from '../select';
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
import { useIntl } from 'react-intl';
|
|
||||||
import { Dialog, DialogBody, DialogFooter, Flex, Typography, Button } from '@strapi/design-system';
|
import { Dialog, DialogBody, DialogFooter, Flex, Typography, Button } from '@strapi/design-system';
|
||||||
import { ExclamationMarkCircle, Trash } from '@strapi/icons';
|
import { ExclamationMarkCircle, Trash } from '@strapi/icons';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { useIntl } from 'react-intl';
|
||||||
|
|
||||||
import InjectionZoneList from '../../../../components/InjectionZoneList';
|
import InjectionZoneList from '../../../../components/InjectionZoneList';
|
||||||
import { getTrad } from '../../../../utils';
|
import { getTrad } from '../../../../utils';
|
||||||
|
|
||||||
|
|||||||
@ -164,7 +164,12 @@ module.exports = {
|
|||||||
return ctx.forbidden();
|
return ctx.forbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
const entity = await entityManager.findOneWithCreatorRoles(id, model);
|
const permissionQuery = await permissionChecker.sanitizedQuery.create(ctx.query);
|
||||||
|
const populate = await getService('populate-builder')(model)
|
||||||
|
.populateFromQuery(permissionQuery)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
const entity = await entityManager.findOne(id, model, { populate });
|
||||||
|
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
return ctx.notFound();
|
return ctx.notFound();
|
||||||
|
|||||||
@ -127,8 +127,8 @@ module.exports = ({ strapi }) => ({
|
|||||||
},
|
},
|
||||||
async clone(entity, body, uid) {
|
async clone(entity, body, uid) {
|
||||||
const modelDef = strapi.getModel(uid);
|
const modelDef = strapi.getModel(uid);
|
||||||
|
const populate = await buildDeepPopulate(uid);
|
||||||
const publishData = { ...body };
|
const publishData = { ...body };
|
||||||
const populateRelations = isRelationsPopulateEnabled(uid);
|
|
||||||
|
|
||||||
if (hasDraftAndPublish(modelDef)) {
|
if (hasDraftAndPublish(modelDef)) {
|
||||||
publishData[PUBLISHED_AT_ATTRIBUTE] = null;
|
publishData[PUBLISHED_AT_ATTRIBUTE] = null;
|
||||||
@ -136,15 +136,13 @@ module.exports = ({ strapi }) => ({
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
data: publishData,
|
data: publishData,
|
||||||
populate: populateRelations
|
populate,
|
||||||
? getDeepPopulate(uid, {})
|
|
||||||
: getDeepPopulate(uid, { countMany: true, countOne: true }),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clonedEntity = await strapi.entityService.clone(uid, entity.id, params);
|
const clonedEntity = await strapi.entityService.clone(uid, entity.id, params);
|
||||||
|
|
||||||
// If relations were populated, relations count will be returned instead of the array of relations.
|
// If relations were populated, relations count will be returned instead of the array of relations.
|
||||||
if (populateRelations) {
|
if (isWebhooksPopulateRelationsEnabled(uid)) {
|
||||||
return getDeepRelationsCount(clonedEntity, uid);
|
return getDeepRelationsCount(clonedEntity, uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -149,7 +149,7 @@ describe('UploadAssetDialog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('snapshots the component with 4 URLs: 3 valid and one in failure', async () => {
|
it('snapshots the component with 4 URLs: 3 valid and one in failure', async () => {
|
||||||
const { debug } = render();
|
render();
|
||||||
fireEvent.click(screen.getByText('From url'));
|
fireEvent.click(screen.getByText('From url'));
|
||||||
|
|
||||||
const urls = [
|
const urls = [
|
||||||
@ -201,8 +201,6 @@ describe('UploadAssetDialog', () => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
debug(undefined, 100000);
|
|
||||||
|
|
||||||
await waitFor(() =>
|
await waitFor(() =>
|
||||||
expect(
|
expect(
|
||||||
screen.getByText(
|
screen.getByText(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user