Skip to content

Commit

Permalink
Fix regression when parent list of a Content field had a where clau…
Browse files Browse the repository at this point in the history
…se as its access control. (#1673)
  • Loading branch information
timleslie committed Sep 18, 2019
1 parent b1d73ab commit 04aa6a0
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .changeset/dry-clouds-sit/changes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"releases": [
{ "name": "@keystone-alpha/field-content", "type": "patch" },
{ "name": "@keystone-alpha/fields", "type": "patch" }
],
"dependents": []
}
1 change: 1 addition & 0 deletions .changeset/dry-clouds-sit/changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression when parent list of a Content field had a `where` clause as its access control.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->

<!-- prettier-ignore -->

<table>
<tr>
<td align="center"><a href="http://www.thinkmill.com.au"><img src="https://avatars3.githubusercontent.com/u/872310?v=4" width="100px;" alt="Jed Watson"/><br /><sub><b>Jed Watson</b></sub></a><br /><a href="https://github.com/keystonejs/keystone-5/commits?author=JedWatson" title="Code">💻</a></td>
Expand Down
2 changes: 1 addition & 1 deletion demo-projects/todo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
"@keystone-alpha/app-static": "^1.1.1",
"cross-env": "^5.2.0"
}
}
}
11 changes: 10 additions & 1 deletion packages/field-content/src/Implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
{}
),
}),
{}
),
});
}

Expand Down
11 changes: 10 additions & 1 deletion packages/fields/src/types/CloudinaryImage/ImageBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
{}
),
}),
{}
),
});
}

Expand Down
11 changes: 10 additions & 1 deletion packages/fields/src/types/OEmbed/OEmbedBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
{}
),
}),
{}
),
});
}

Expand Down
11 changes: 10 additions & 1 deletion packages/fields/src/types/Unsplash/UnsplashBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
{}
),
}),
{}
),
});
}

Expand Down

0 comments on commit 04aa6a0

Please sign in to comment.