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 add the "Revisions" tab on groups, but the full functionality will be combined on the parent issue.

Comments

jidrone created an issue. See original summary.

jidrone’s picture

Status: Active » Needs review
StatusFileSize
new34.41 KB

Here is the patch.

jidrone’s picture

StatusFileSize
new40.44 KB
new19.59 KB

Added a fix to make content moderation optional when reverting revisions.

jidrone’s picture

StatusFileSize
new40.67 KB
new681 bytes

Added view link on revision tab list, for better UX.

jwilson3’s picture

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

$ wget https://www.drupal.org/files/issues/2019-02-15/group-revisions-tab-3029908-4_0.patch
$ git apply group-revisions-tab-3029908-4_0.patch
error: patch failed: group.services.yml:33
error: group.services.yml: patch does not apply
error: patch failed: src/Entity/Controller/GroupController.php:7
error: src/Entity/Controller/GroupController.php: patch does not apply
jwilson3’s picture

Status: Needs review » Needs work
jwilson3’s picture

Status: Needs work » Needs review
StatusFileSize
new40.67 KB
new40.76 KB

The patch in #4 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, so an interdiff is not really possible. There were a few very minor merge conflicts between rc4 and rc5 and 8.x-1.x.

jwilson3’s picture

StatusFileSize
new43.14 KB
new5.12 KB

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, yaml file formatting consistency with other entries in the same file, and added the "Revisions" group operation (similar to View, Edit, Members operations) w/ tests.

The last submitted patch, 8: group-revisions-tab-3029908-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jwilson3’s picture

Whoops ignore these patches. wrong issue.

jwilson3’s picture

I guess the reason for these fails is that the tests require code from #3029907 to execute successfully, which explains why they were removed in previous patches :(

Note that the test that fails here runs successfully once merged with the sibling issues in the parent issue (see test on comment #53 #2829966-53: Support for Revisions on groups).

sadysierralta’s picture

Made some small changes to allow the patch work in D9.

The last submitted patch, 12: group-revisions-tab-3029908-12.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kristiaanvandeneynde’s picture

Status: Needs review » Needs work

The last submitted patch, 14: group-3029908-14.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kristiaanvandeneynde’s picture

Status: Needs work » Needs review

Small update while I'm working on this: There's a lot of code copy-pasted from node in this patch that core is trying to get rid of. So I'm completely revising this patch to use more from Entity API (the module we depend on) and core itself.

kristiaanvandeneynde’s picture

Status: Needs review » Needs work
kristiaanvandeneynde’s picture

Status: Needs work » Needs review
StatusFileSize
new26.67 KB

This is fully reviewed code-wise but still needs tests. The only thing that still needs work is GroupRevisionDeleteForm (and its route declaration) as we are using the RevisionRevertForm and its route declaration form Entity API, but said module does not have a delete form for us to use and I'm asking around about why that is.

Furthermore, the mini-form for content moderation will check for global "use foo transition" permissions, but that's out of scope for this patch. Ideally, that one also gets a group permission based alternative by decorating StateTransitionValidation and looping over the workflows to declare group permissions where applicable (i.e. the enabled group types).

Status: Needs review » Needs work

The last submitted patch, 18: group-3029908-18.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kristiaanvandeneynde’s picture

Status: Needs work » Needs review
StatusFileSize
new27.33 KB

Whoops, misplaced a file.

Also the delete form seems to be missing due to it never being finished in #2625122: [Meta] Implement a generic revision UI.
Relevant core issue here: #2350939: Implement a generic revision UI

I'll review both issues next week.

Status: Needs review » Needs work

The last submitted patch, 20: group-3029908-20.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kristiaanvandeneynde’s picture

Status: Needs work » Needs review
StatusFileSize
new27.36 KB

Okay so reviewing the other issues, it seems clear that the code we're borrowing from Entity API isn't going to get updated soon because more effort is going into the core issue.

This means we should add our own delete form and route for the time being until we can safely rely on Drupal 9.3.0 (or later if commit is delayed) and up. The approach taken still borrows most code from Entity API so we should be safe with regard to copying stale core code like the original patch did.

Attached patch should also fix the test fails.

Status: Needs review » Needs work

The last submitted patch, 22: group-3029908-22.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kristiaanvandeneynde’s picture

Status: Needs work » Needs review
StatusFileSize
new27.65 KB

Expecting this to go green now, so I'll work on the delete form and finish up by writing tests.

kristiaanvandeneynde’s picture

StatusFileSize
new27.75 KB

Still needs tests but has the right delete form now.

kristiaanvandeneynde’s picture

StatusFileSize
new35.36 KB

Here's some tests already for the overview access checks. Now that I got that working, the other routes should hopefully be easy to pull off.

kristiaanvandeneynde’s picture

StatusFileSize
new45.51 KB

This adds all the UI access check tests. I'd like to harden the view case a bit more regarding unpublished groups, but the route access tests are pretty much finished now.

kristiaanvandeneynde’s picture

StatusFileSize
new52.27 KB

This severely expands view access tests. I'm checking the patch one last time to see if it needs more tests and will then probably commit it.

kristiaanvandeneynde’s picture

StatusFileSize
new261.31 KB

Wow, this was a nightmare to fix. Turns out some pages were broken because of missing revision users or timestamps. After a long hard search, I found that the mechanisms in core to convert an entity type to be revisionable just doesn't care at all about these fields. So I ended up having to write an update test after all to confirm that this bug is fixed by adding a custom storage.

kristiaanvandeneynde’s picture

Status: Needs review » Fixed

Okay, fixed. Waiting for reviews to come in and then cutting a new release.

Status: Fixed » Closed (fixed)

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

richarddavies’s picture

Component: Group (group) » Code
StatusFileSize
new7.84 KB

After upgrading to Drupal 10, all of my groups now have two "Revisions" tabs:

Screenshot showing two Revisions tabs on a group.

Both tabs link to /[group_alias]/revisions. I'm using Groups 1.5 and Drupal 10.1.2.

richarddavies’s picture

StatusFileSize
new561 bytes

In case anyone else runs into this issue, here's a patch to remove the redundant Revisions tab that's now being added by Groups. (The other tab is coming from Drupal 10's system.links.task.yml.)

kristiaanvandeneynde’s picture

Please file a new issue for this (or search if one exists)

kristiaanvandeneynde’s picture

caesius’s picture

Split off a new ticket to address the issue with duplicate Revisions tabs. #3397063: Drupal 10.1: Revisions tab appears twice on Groups