Problem/Motivation

This is a child issue of #2829966: Support for Revisions on groups to make the issue easier to review by splitting it.

Proposed resolution

This patch only contains the code to make group entity type revisionable, but the full functionality will be combined on the parent issue.

Comments

jidrone created an issue. See original summary.

jidrone’s picture

Title: Makes groups revisionable » Make groups revisionable
Issue summary: View changes
jidrone’s picture

jidrone’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: group-make-revisionable-3029907-3.patch, failed testing. View results

jidrone’s picture

Status: Needs work » Needs review

Changed to Needs review because is expected the tests failed, it only works combined with #2873212: Add a status to the group (Publish/Unpublish).

lobsterr’s picture

Status: Needs review » Needs work

@jidrone I applied your latest patch from Add status, then the current the current patch can't be applied. Can you please update it?

heddn’s picture

Issue tags: +Needs reroll
jidrone’s picture

Hi everyone, to test group revisionable you need to apply the parent patch #2829966: Support for Revisions on groups, this patch is only intended to make code review easier.

jidrone’s picture

Status: Needs work » Needs review

Changed the status to "Needs review" because this ticket is only for code review.

jwilson3’s picture

Patch no longer applies to latest 8.x-1.x

$ wget https://www.drupal.org/files/issues/2019-01-31/group-make-revisionable-3029907-3.patch
$ git apply group-make-revisionable-3029907-3.patch
error: patch failed: group.post_update.php:45
error: group.post_update.php: patch does not apply
error: patch failed: group.services.yml:33
error: group.services.yml: patch does not apply
error: patch failed: src/Entity/Group.php:43
error: src/Entity/Group.php: patch does not apply
jwilson3’s picture

Status: Needs review » Needs work
jwilson3’s picture

Status: Needs work » Needs review
StatusFileSize
new18.26 KB
new18.37 KB

The patch in #3 applied to 8.x-1.0-rc4 but not 8.x-1.0-rc5 nor 8.x-1.x branch so I've uploaded two re-rolls, one for each in case someone needs.

These are automated re-rolls based on git rebase, there was only one very minor merge conflict between rc4 and rc5, and there were no merge conflicts between rc5 and 1.x branch.

The last submitted patch, 13: group-make-revisionable-3029907-13-8.x-1.x.patch, failed testing. View results

jwilson3’s picture

This patch brings down a few additions from the parent ticket's latest patch #2829966-47: Support for Revisions on groups.

See interdiff to identify the changes. A few alphabetical order of use statements and added some tests.

Status: Needs review » Needs work

The last submitted patch, 15: group-make-revisionable-3029907-14.patch, failed testing. View results

kristiaanvandeneynde’s picture

Assigned: Unassigned » kristiaanvandeneynde

Looking into this as part of sponsored work by Global Game Jam

kristiaanvandeneynde’s picture

Status: Needs work » Needs review
StatusFileSize
new21.05 KB

Straight reroll, no reviews yet.

kristiaanvandeneynde’s picture

Issue tags: -Needs reroll
StatusFileSize
new21.18 KB

Finished my code review, need to review tests now.

Keep in mind that since the last patch, core fixed an update problem in taxonomy and menu related to code borrowed in this patch. I've left out said code for now, but for posterity, the issues are:

It would need a hook_requirement and an adjustment to the post_update hook to mimic core properly. I could not find any corrupt group entities on my test install, but who knows how people managed to mess up their databases :P

That said, attached patch has the revised code. Mainly dropped deprecated code that slipped in from copy-pasting core code and overhauled the route access check to be more alterable as per #2943471: LatestRevisionCheck overrules any other node access module

Next up: Test coverage.

kristiaanvandeneynde’s picture

StatusFileSize
new42.78 KB

Whoops, access check was using AccessResult rather than GroupAccessResult. Copy-pasting is bad m'kay?

Also, the fact that above patch goes green shows why we need more tests.

kristiaanvandeneynde’s picture

StatusFileSize
new21.19 KB

Misclicked in SourceTree... :)

kristiaanvandeneynde’s picture

Okay I've asked core maintainers and they recommend adding in the aforementioned safety checks because people somehow get their DBs in bad shape.

That said, our sponsor should not pay for this, given how I would also need to write the update hook tests and all and therefore I suggest we move forward assuming no-one messed up their DB somehow. If we do get reports of people not being able to update, we can have the community come up with a patch by copy-pasting the work done in the two linked core issues.

Focusing on the tests for this issue again.

kristiaanvandeneynde’s picture

StatusFileSize
new28.53 KB

Wow, writing tests for revisions is so painful. But, after many hours of debugging, here we go.

kristiaanvandeneynde’s picture

Status: Needs review » Fixed

Changed a small base field typo and pushed. Thanks all!

Status: Fixed » Closed (fixed)

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