Commit da38a356 authored by Nikolay Lobachev's avatar Nikolay Lobachev
Browse files

Issue #3310773 by LOBsTerr, jlscott: Missing $group argument to...

parent 4fb76abd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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(),
+20 −0
Original line number Diff line number Diff line
@@ -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);
  }

}