-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "create drafts" permission #2923
Comments
It’s not possible to create a draft without also creating an entry, so splitting off drafts as its own thing would be unenforceable. That said I’ll look into the feasibility of avoiding creating new entry versions when a new entry is immediately saved to a draft, and also when nothing substantial changes. Not totally sure where the line should be on that though - e.g. if only the Post Date changes, should that qualify as a new version? |
@brandonkelly I think it would make sense to not trigger a new entry version for changes to any of the data in the right hand column:
|
I’ve just made a change that will at least prevent new versions from being created when absolutely nothing changes.
Not sure I agree. As long as Craft is remembering the complete state of an entry in its version data, then any change to that state should probably be stored. That said, I’ve made it possible for you to alter the behavior, by placing the revision comparison check in its own protected function: cms/src/services/EntryRevisions.php Lines 500 to 503 in abbf2f0
If you want to only store new revisions when the custom fields change, then you can create a new class that extends <?php
class MyEntryRevisions extends craft\services\EntryRevisions
{
protected function compareRevisionData(array $revisionA, array $revisionB): bool
{
return $revisionA['fields'] !== $revisionB['fields'];
}
}
return [
'components' => [
'entryRevisions' => [
'class' => MyEntryRevisions::class,
],
],
]; |
Great, thanks Brandon. I'm looking forward to this being released 😃 |
It would be nice to have a permission setting that allows a user to only create drafts.
Currently the nearest I can get to this is by checking "create entries" permission and keeping the "publish live changes" permission unchecked.
However, this allows users to:
I am working on a site that requires strict control over entry versions (we fetch and display each version on the front-end). Creating a disabled entry also adds a row to the
entryversions
table. This means when this entry is enabled (by somebody with permission) it now has two versions, when in reality the actual content only has been edited once. I think another discussion to be had here is should changing the enabled state of an entry add a new row to theentryversions
table?The text was updated successfully, but these errors were encountered: