If there are already Group entities of a Group type and the menu content is enabled for this Group Type, creating Menus for already available Group entities of this type creates two identical duplicate records in the group_content_field_data. Any subsequent groups created adds just a normal single entry in the group_content_field_data as expected. So the bug actually is only when menus are created for already existing group entities.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Drupak created an issue. See original summary.

Dakwamine’s picture

Just wanted to add that I have also had those duplicate entries for some reason. They refer to the same menu.

edysmp’s picture

I was checking this and seems duplication is only happen when Group content menus are created through the UI (/group/{group_id}/menu/add) and not when are created automactically when creating the Group.

edysmp’s picture

Status: Active » Needs review
FileSize
2.07 KB

Here is a test that confirm the issue.

Status: Needs review » Needs work

The last submitted patch, 4: 3144201-4.patch, failed testing. View results

edysmp’s picture

Status: Needs work » Needs review
FileSize
4 KB

Here is a fix.
This was the problem, We were saving the group content, but Group module is doing that by default.
Deleting that, we not longer have access to the group content entity when generating a url for the group content menu entity.

edysmp’s picture

FileSize
1.92 KB

Adding a interfdiff

heddn’s picture

+++ b/src/Form/GroupContentMenuForm.php
@@ -359,31 +359,19 @@ class GroupContentMenuForm extends ContentEntityForm {
+    $message_arguments = $logger_arguments;

Nit: If these are the same thing, then no need to have 2 distinct variables. Maybe just one $arguments is enough?

edysmp’s picture

#8: It makes sense.

  • heddn committed 626957a on 8.x-1.x authored by edysmp
    Issue #3144201 by edysmp, Drupak, heddn: Duplicate identical entries for...
heddn’s picture

Status: Needs review » Fixed

Thanks for all your contributions, especially the tests.

Status: Fixed » Closed (fixed)

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