I would like to provide some useful options related to content moderation for this module.

1. Give the choice to the users to keep node revisions with "Published" moderation state.
2. If 1. is selected, give further choice to users to save revision logs and basic data from deleted revisions into the closest published revision. This second option would allow to remove most "draft/working/in progress" states revisions while still keeping some logs about what happened in the published revisions which are kept alive.

CommentFileSizeAuthor
#31 interdiff_28_to_31.txt2.62 KBjoseph.olstad
#31 3217675-31.patch3.97 KBjoseph.olstad
#30 This_option_does_not_remove_published.png10.52 KBjoseph.olstad
#28 interdiff_26_to_28.txt1021 bytesjoseph.olstad
#28 3217675-28.patch3.96 KBjoseph.olstad
#26 3217675-26.patch3.92 KBjoseph.olstad
#20 French revisions after deletion.JPG132.75 KBsmulvih2
#20 English revisions after deletion.JPG45.64 KBsmulvih2
#20 Candidate revisions.JPG105.41 KBsmulvih2
#20 French revisions.JPG91.46 KBsmulvih2
#20 English revisions.JPG84.25 KBsmulvih2
#13 interdiff_9-13.txt2.09 KBvsujeetkumar
#13 3217675-13.patch27.51 KBvsujeetkumar
#10 content-moderation-support-3217675-9.patch25.66 KBcasaran
#8 3217675-interdiff_6_7.txt12.51 KBitamair
#8 content-moderation-support-3217675-7.patch26.17 KBitamair
#3 content-moderation-support-3217675-3.patch20.1 KBcasaran
#6 content-moderation-support-3217675-6.patch21 KBcasaran
#2 content-moderation-support-3217675.patch20.69 KBcasaran
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

casaran created an issue. See original summary.

casaran’s picture

Here is the first try for a patch.

casaran’s picture

Another try. The patch is actually applying against 1.x-dev, I tested it locally.

casaran’s picture

Issue summary: View changes
itamair’s picture

Status: Active » Needs work

The patch is not applying correctly because the patch is looking for a file "/src/NodeRevisionPublishedDeleteBatch.php" that doesn't exists ...
Probably that patch is malformed, and generated on a code base that is already an amend of 8.x-1.x-dev

casaran’s picture

Status: Needs work » Active
FileSize
21 KB

Adding README documentation.

itamair’s picture

Title: Add content moderation support » Add content moderation support, for preserving "published" state revisions
itamair’s picture

@thanks Casaran
This new patch is providing the following enhancements:
- default definition of the additional module settings in the install/config file, and extension of the schema accordingly;
- more defensive code for checking the existence of the "content_moderation" module enabled;
- improved drupal/php coding standards;
...

Status: Needs review » Needs work

The last submitted patch, 8: content-moderation-support-3217675-7.patch, failed testing. View results

casaran’s picture

Status: Needs work » Active
FileSize
25.66 KB

Thank you @itamair

One more version, based and yours but putting all the save log logic inside the batch. This is to avoid a timeout when we have too many revisions.

itamair’s picture

Status: Active » Needs work

It looks these last patches are causing some tests failing ... so I guess they stil need some fixes, at least on their part that break the existing tests (or the test should be adjusted accordingly)

vistree’s picture

Hello!
can someone explain the problem to me in a little more detail? I don't understand it at the moment. Shouldn't a node have only ONE published revision? Is there currently a problem using the module in combination with content moderation? It is the core content moderation that the author is referring to, right?

vsujeetkumar’s picture

Fixing fail test in #10.

casaran’s picture

@vistree

There is no issue per se. It's just added features.

And yes it's about the core content moderation. Let's consider the following use case. You have one node which you first save as a draft, then publish. later on you edit it again and save as draft and publish it again after that. So you have 4 revisions, 2 "draft" and 2 "published". The goal here is to remove the draft revisions while keeping the published ones, because it might be a legal requirement in some cases to always keep what has been officially published and displayed on a website. That's all!

vistree’s picture

@casaran: thanx for explanation. Now I got the "problem" behind this issue ;-)

mkolar’s picture

i can confirm this works, maybe one suggestion is: it would be good if you can select how many published revisions to keep because you can end up with lot of published revisions which are all excluded. But this helps anyway! Thank you!

mkolar’s picture

Status: Needs review » Reviewed & tested by the community

Marking as OK, works as if. I don't think this needs to be blocked by my upper comment.

mkolar’s picture

Status: Reviewed & tested by the community » Needs work
mkolar’s picture

I think there should be rather option to keep latest default revision, for our project i thought this will help but found out we have to keep latest default revision, here is why: imagine you have article in published state, then it god unpublished (which is default revision) so article should be unpublished, then article gets some drafts... with current version of module + this patch the unpublished revision will be deleted which makes article public again, this is wrong! There should be option to omit last default revision and not hardcoding it to "published" state because with moderation state, there could be also other state which is marked as published.

smulvih2’s picture

I tested this patch and it doesn't seem to play nice with content translations.

First I created an English node and added a French translation. Then I added a bunch of revisions to English and a bunch of revisions to French.

English revisions:
English revisions

French revisions:
French revisions

Candidates for deletion:
Candidates for deletion

As you can see in the last image above, all published and draft English revisions are candidates for deletion except the latest draft revision. On the French side, only the first draft (Brouillon) revision is a candidate for deletion, and all other published and draft French revisions will remain.

English revisions after deletion:
English revisions after deletion

French revisions after deletion:
French revisions after deletion

After deletion, only one English draft remains and the deleted revisions logs are not copied to it. On the French side, only the first draft revision is deleted and all English and French deleted revision logs are appended to the first published French revision.

I think there is some overlap with #3118464 in terms of accounting for content translations.

seanB’s picture

We just added a 2.x version of the module. This is a complete rewrite based on plugins to determine which revisions can be deleted. It also uses a queue worker to actually delete revisions. The default revision will never be deleted by the queue worker. Could you please test if this solves the issues you currently experience?

joseph.olstad’s picture

Patch #13 does not apply to 2.x

It would be nice to have translation support.

seanB’s picture

Version 2.x does not need the patch and should already fix the issue :)

joseph.olstad’s picture

ok great, thank you @seanB

joseph.olstad’s picture

@seanB,
After extensive testing we came to the conclusion that version 2.x doesn't fix this issue,

I'm still reviewing possible action to take.

joseph.olstad’s picture

FileSize
3.92 KB

I haven't tested this yet.

joseph.olstad’s picture

joseph.olstad’s picture

Ok this one works, nice design for this 2.x version, was easy to implement this solution.

joseph.olstad’s picture

Status: Needs work » Needs review
joseph.olstad’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
FileSize
10.52 KB

I'd say forget about doing this in 1.x, upgrade to 2.x, check patch #28, it works well, there's a new configuration option added.
Does not delete published historical revisions

joseph.olstad’s picture

adriancid’s picture

Status: Needs review » Fixed

Thanks

joseph.olstad’s picture

https://www.drupal.org/project/node_revision_delete/releases/2.0.0-beta1
Thanks for the release! Now everyone can enjoy it without patching.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.