Loading ginvite.module +5 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,11 @@ function ginvite_group_content_delete(GroupContentInterface $group_content) { } if ($group_content->getContentPlugin()->getPluginId() == 'group_membership') { // The user was removed and there is no entity. if (empty($group_content->getEntity())) { return; } $properties = [ 'entity_id' => $group_content->getEntity()->id(), 'gid' => $group_content->getGroup()->id(), Loading tests/src/Kernel/GroupInviteTest.php +20 −0 Original line number Diff line number Diff line Loading @@ -173,4 +173,24 @@ class GroupInviteTest extends GroupKernelTestBase { return $group_content; } /** * Test user removal. */ public function testUserRemoval() { $account = $this->createUser(); $user_id = $account->id(); // Add an invitation. $this->createInvitation($this->group, $account); $account->delete(); // When user removed the invitations, should be removed too. $group_invitations = $this->invitationLoader->loadByProperties([ 'gid' => $this->group->id(), 'entity_id' => $user_id, ]); $this->assertCount(0, $group_invitations); } } Loading
ginvite.module +5 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,11 @@ function ginvite_group_content_delete(GroupContentInterface $group_content) { } if ($group_content->getContentPlugin()->getPluginId() == 'group_membership') { // The user was removed and there is no entity. if (empty($group_content->getEntity())) { return; } $properties = [ 'entity_id' => $group_content->getEntity()->id(), 'gid' => $group_content->getGroup()->id(), Loading
tests/src/Kernel/GroupInviteTest.php +20 −0 Original line number Diff line number Diff line Loading @@ -173,4 +173,24 @@ class GroupInviteTest extends GroupKernelTestBase { return $group_content; } /** * Test user removal. */ public function testUserRemoval() { $account = $this->createUser(); $user_id = $account->id(); // Add an invitation. $this->createInvitation($this->group, $account); $account->delete(); // When user removed the invitations, should be removed too. $group_invitations = $this->invitationLoader->loadByProperties([ 'gid' => $this->group->id(), 'entity_id' => $user_id, ]); $this->assertCount(0, $group_invitations); } }