Problem/Motivation

When the Trash module is enabled, group content menus are not cleaned up when a group is deleted through trash.

The existing cleanup logic in group_content_menu_group_delete relies on loading group relationships. However, when the Trash module purges a group, the group relationships have already been removed from the database by the time hook_group_delete fires. So the menus are never deleted — they remain as orphans in the group_content_menu_field_data table.

Steps to reproduce

  1. Enable the Trash module
  2. Create a group
  3. Create a menu
  4. Delete the group (this soft-deletes/trashes it)
  5. Delete the group from trash (hard delete)
  6. Check the group_content_menu_field_data database table — the group menu is still present

Proposed resolution

React to group relationships being deleted, and delete the menu if it doesn't have other relationships pointing to it.

Remaining tasks

User interface changes

API changes

Data model changes

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

alecsmrekar created an issue. See original summary.

alecsmrekar’s picture

Assigned: alecsmrekar » Unassigned
Status: Active » Needs review
gabesullice’s picture

Status: Needs review » Reviewed & tested by the community

Works exactly as promised :)

heddn’s picture

Status: Reviewed & tested by the community » Needs work

Posted some feedback on the MR.