diff --git a/.changeset/dry-clouds-sit/changes.json b/.changeset/dry-clouds-sit/changes.json new file mode 100644 index 00000000000..34a19e99100 --- /dev/null +++ b/.changeset/dry-clouds-sit/changes.json @@ -0,0 +1,7 @@ +{ + "releases": [ + { "name": "@keystone-alpha/field-content", "type": "patch" }, + { "name": "@keystone-alpha/fields", "type": "patch" } + ], + "dependents": [] +} diff --git a/.changeset/dry-clouds-sit/changes.md b/.changeset/dry-clouds-sit/changes.md new file mode 100644 index 00000000000..0efdd10b7e6 --- /dev/null +++ b/.changeset/dry-clouds-sit/changes.md @@ -0,0 +1 @@ +Fix regression when parent list of a Content field had a `where` clause as its access control. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bcb9e9d43f9..ef404196bab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -134,7 +134,9 @@ We also build commonjs builds to run in node (for testing with jest or etc.) and Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + diff --git a/demo-projects/todo/package.json b/demo-projects/todo/package.json index 64a72a0c843..f2389ff2456 100644 --- a/demo-projects/todo/package.json +++ b/demo-projects/todo/package.json @@ -22,4 +22,4 @@ "@keystone-alpha/app-static": "^1.1.1", "cross-env": "^5.2.0" } -} \ No newline at end of file +} diff --git a/packages/field-content/src/Implementation.js b/packages/field-content/src/Implementation.js index 9b75cf77ffc..cd03a1e1df3 100644 --- a/packages/field-content/src/Implementation.js +++ b/packages/field-content/src/Implementation.js @@ -167,7 +167,16 @@ export class Content extends Relationship.implementation { }; }, }, - access: listConfig.listAccess, + access: Object.entries(listConfig.listAccess).reduce( + (acc, [schemaName, access]) => ({ + ...acc, + [schemaName]: Object.entries(access).reduce( + (acc, [op, rule]) => ({ ...acc, [op]: !!rule }), // Reduce the entries to truthy values + {} + ), + }), + {} + ), }); } diff --git a/packages/fields/src/types/CloudinaryImage/ImageBlock.js b/packages/fields/src/types/CloudinaryImage/ImageBlock.js index e8f32fe066c..242b6299423 100644 --- a/packages/fields/src/types/CloudinaryImage/ImageBlock.js +++ b/packages/fields/src/types/CloudinaryImage/ImageBlock.js @@ -57,7 +57,16 @@ export class ImageBlock extends Block { 'A reference back to the Slate.js Serialised Document this image is embedded within', }, }, - access: listConfig.listAccess, + access: Object.entries(listConfig.listAccess).reduce( + (acc, [schemaName, access]) => ({ + ...acc, + [schemaName]: Object.entries(access).reduce( + (acc, [op, rule]) => ({ ...acc, [op]: !!rule }), // Reduce the entries to truthy values + {} + ), + }), + {} + ), }); } diff --git a/packages/fields/src/types/OEmbed/OEmbedBlock.js b/packages/fields/src/types/OEmbed/OEmbedBlock.js index 34ae28942eb..37e4925e521 100644 --- a/packages/fields/src/types/OEmbed/OEmbedBlock.js +++ b/packages/fields/src/types/OEmbed/OEmbedBlock.js @@ -51,7 +51,16 @@ export class OEmbedBlock extends Block { 'A reference back to the Slate.js Serialised Document this embed is contained within', }, }, - access: listConfig.listAccess, + access: Object.entries(listConfig.listAccess).reduce( + (acc, [schemaName, access]) => ({ + ...acc, + [schemaName]: Object.entries(access).reduce( + (acc, [op, rule]) => ({ ...acc, [op]: !!rule }), // Reduce the entries to truthy values + {} + ), + }), + {} + ), }); } diff --git a/packages/fields/src/types/Unsplash/UnsplashBlock.js b/packages/fields/src/types/Unsplash/UnsplashBlock.js index 9e844ea458c..6d05eaeb7ec 100644 --- a/packages/fields/src/types/Unsplash/UnsplashBlock.js +++ b/packages/fields/src/types/Unsplash/UnsplashBlock.js @@ -63,7 +63,16 @@ export class UnsplashBlock extends Block { 'A reference back to the Slate.js Serialised Document this unsplash image is contained within', }, }, - access: listConfig.listAccess, + access: Object.entries(listConfig.listAccess).reduce( + (acc, [schemaName, access]) => ({ + ...acc, + [schemaName]: Object.entries(access).reduce( + (acc, [op, rule]) => ({ ...acc, [op]: !!rule }), // Reduce the entries to truthy values + {} + ), + }), + {} + ), }); }
Jed Watson
Jed Watson

💻