Clean code

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-09-01 10:07:24 +02:00 committed by Pierre Noël
parent bea6dada63
commit bb4cea6019
4 changed files with 2 additions and 21 deletions

View File

@ -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'], '');

View File

@ -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';

View File

@ -1,5 +0,0 @@
import { omit } from 'lodash';
const removePublishedAtFromMetas = metas => omit(metas, ['published_at']);
export default removePublishedAtFromMetas;

View File

@ -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 });
});
});