Split from #3029908: Add revisions tab on groups

Problem/Motivation

When allowing revisions on Groups in Drupal 10.1, a duplicate Revisions tab appears.

Steps to reproduce

- Install Group module on Drupal 10.1; specific module version doesn't seem to matter (happens on v1/v2/v3).
- Create a new Group Type. Ensure "Create a new revision when a group is modified" is checked (default). No need to update any settings from default options. No need to add fields or set anything else up.
- Create a new Group ("Add Group"). Mindlessly create the group and complete membership.
- You'll land on the page for your own "group membership relationship." Use the breadcrumb links to find your way to the group you just created.
- Group will show two Revisions tabs.

look at them tabs

Proposed resolution

Don't show two Revisions tabs, only show one of them (but definitely don't show zero of them, even on Drupal 9 or 10.0).

The patch provided in the first comment resolves the issue in Drupal 10.1 but zaps the revisions tab in Drupal 9 and 10.0. It can be used as a temporary fix for Drupal 10.1 sites but cannot be applied to the project as-is.

However, if this issue does not get addressed by Dec 13th, 2023 when Drupal 10.0 goes End-of-Life, then we may be able to apply this patch and stage new backward-incompatible minor versions of the project, assuming the patch is otherwise sound.

Patch credit @RichardDavies

Remaining tasks

Write a patch (or patches) which apply to Groups versions 1, 2, and 3 and which work on Drupal 9.5 through 10.1.

Issue fork group-3397063

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

caesius created an issue. See original summary.

caesius’s picture

caesius’s picture

Issue summary: View changes
le72’s picture

Have the same issue. Drupal 10.1.6, Group 3.2.1.

markfien’s picture

Same issue with Drupal 10.1.6, Group 2.2.1

le72’s picture

The patch #2 fixed the issue.

idebr’s picture

Status: Active » Needs review
markfien’s picture

The patch is for 3.x -- we are using 2.x -- is there a patch for that version please.

le72’s picture

Status: Needs review » Reviewed & tested by the community
caesius’s picture

Status: Reviewed & tested by the community » Needs work

Please read the issue description.

This patch only works on Drupal 10.1.

Drupal 10.0 is not EOL until December 13th and even then it would be up to the project owner to decide whether to apply this patch as-is, making the project incompatible with Drupal <10.1.

If you're able to provide a patch that also works on Drupal 9.5 and Drupal 10.0 then please do so.

caesius’s picture

msnassar’s picture

Status: Needs work » Needs review
Related issues: +#2350939: Implement a generic revision UI
StatusFileSize
new679 bytes

Here is a patch that should work for all versions.

somebodysysop’s picture

@msnassar The patch in #12 works for all versions of Drupal (9/10) or all versions of Group? We are running Group 2.x.

msnassar’s picture

@SomebodySysop It should work for all Group (1/2/3) and Drupal (9/10) versions. However, you don't need it for Drupal < 10.1
Note: This is a temporary fix. It can be used until Core and Group completely switch to the generic revision UI.

ulethjay’s picture

I'm curious now...

Patch #2 removed the group module's link task and patch #12 removed core's link task.

Which, if either is the correct approach?

ulethjay’s picture

Well... here's my take on a patch. Rather than simply removing one or the other, I went with checking the local menu for duplicate "Revisions" tabs and removing all but the first.

In theory it could be applied to any past or future version of Drupal or Group, and not do anything silly. Though I've only tried it on Drupal 10.1 and Group 3.2.x

Edit:
I acknowledge that this is a dirty hack. But hopefully hack that won't break stuff if accidentally left in place after a more thorough fix is implemented.

kristiaanvandeneynde’s picture

Status: Needs review » Active
Issue tags: +Group 3.3.0

This will be fixed in the next release because that one will bump the minimum supported core version to 10.2 and therefore allow me to remove my copy of the local task.

kristiaanvandeneynde’s picture

Version: 3.2.x-dev » 3.3.x-dev
Assigned: Unassigned » kristiaanvandeneynde

Will go with the fix from seanB in #3397214: Duplicate revisions tab with Drupal 10.1, so adding credit. We can take that approach now that we've bumped the minimum version to D10.2 In a world where we kept older D10 versions supported, @ulethjay's patch actually makes sense, so I wouldn't consider it a dirty hack per se.

kristiaanvandeneynde’s picture

Assigned: kristiaanvandeneynde » Unassigned
Status: Active » Needs review
kristiaanvandeneynde’s picture

Right, this goes green so if anyone can confirm this is working on their end, I've got the +1 I need to commit this.

caesius’s picture

seanB's patch appears identical to the one I initially attached to this issue; I took it from RichardDavies on the parent ticket: https://www.drupal.org/project/group/issues/3029908#comment-15205403

edit: Well, not exactly identical, the path to the group.links.task.yml file is different. Frankly not sure how the "original" worked then...

kristiaanvandeneynde’s picture

Yeah, you got credit too for that. Just mentioning why I'm adding seanB to the list.

caesius’s picture

I didn't write the patch though, so make sure to credit RichardDavies -- he got to this way before anyone else :P

kristiaanvandeneynde’s picture

caesius’s picture

Anyway, I've just tested the other patch and it also appears to work. Not sure what's up with the different paths between the two files but as long as they commit to the actual project identically then it's a non-issue.

I have tested this on Drupal 10.1 on Group 2.x with an actual project (and been using the patch on production for months) and it checked out fine there.

However on Drupal 10.2/Group 3.2.2 with a sandbox project I should note that applying the patch on an existing installation results in a WSOD:

In DiscoveryTrait.php line 53:

  The "group_permission" plugin does not exist. Valid plugin IDs for Drupal\views\Plugin\ViewsPluginManager are: perm, role, none

I have no idea if it's a "just me" issue or not, but this definitely needs more testing on latest Drupal+Group 3.2.2 to confirm that committing this won't hose existing projects. I've reinstalled several times and I get the error whether I apply or un-apply the patch after installing and setting up Groups.

kristiaanvandeneynde’s picture

Given how all tests go green I'm erring on a "just you" issue :) But thanks for bringing it up, definitely something to keep an eye on.

kristiaanvandeneynde’s picture

Status: Needs review » Fixed

Just confirmed this was working on on of our installations. Committing

Status: Fixed » Closed (fixed)

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

mably’s picture

Bug still present on group 2.2.2...

kristiaanvandeneynde’s picture

StatusFileSize
new104.77 KB

mably’s picture

StatusFileSize
new544 bytes