mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 23:24:03 +00:00
Clean code
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
bea6dada63
commit
bb4cea6019
@ -12,7 +12,7 @@ import { useDrop } from 'react-dnd';
|
||||
import { DropdownItem } from 'reactstrap';
|
||||
import { Inputs as Input } from '@buffetjs/custom';
|
||||
import pluginId from '../../pluginId';
|
||||
import { ItemTypes, getRequestUrl, removePublishedAtFromMetas } from '../../utils';
|
||||
import { ItemTypes, getRequestUrl } from '../../utils';
|
||||
import PopupForm from '../../components/PopupForm';
|
||||
import SettingsViewWrapper from '../../components/SettingsViewWrapper';
|
||||
import SortWrapper from '../../components/SortWrapper';
|
||||
@ -81,9 +81,8 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
|
||||
|
||||
const listRemainingFields = useMemo(() => {
|
||||
const metadatas = get(modifiedData, ['metadatas'], {});
|
||||
const filteredMetadatas = removePublishedAtFromMetas(metadatas);
|
||||
|
||||
return Object.keys(filteredMetadatas)
|
||||
return Object.keys(metadatas)
|
||||
.filter(key => {
|
||||
const type = get(attributes, [key, 'type'], '');
|
||||
|
||||
|
||||
@ -4,4 +4,3 @@ export { default as getFieldName } from './getFieldName';
|
||||
export { default as getRequestUrl } from './getRequestUrl';
|
||||
export { default as getTrad } from './getTrad';
|
||||
export { default as ItemTypes } from './ItemTypes';
|
||||
export { default as removePublishedAtFromMetas } from './removePublishedAtFromMetas';
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
import { omit } from 'lodash';
|
||||
|
||||
const removePublishedAtFromMetas = metas => omit(metas, ['published_at']);
|
||||
|
||||
export default removePublishedAtFromMetas;
|
||||
@ -1,12 +0,0 @@
|
||||
import removePublishedAtFromMetas from '../removePublishedAtFromMetas';
|
||||
|
||||
describe('CONTENT MANAGER | utils | removePublishedAtFromMetas', () => {
|
||||
it('should remove the published_at key from the given object', () => {
|
||||
const data = {
|
||||
ok: true,
|
||||
published_at: true,
|
||||
};
|
||||
|
||||
expect(removePublishedAtFromMetas(data)).toEqual({ ok: true });
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user