Problem/Motivation

When an invited user is already registered and logs in, ginvite can auto-accept their invitation (if autoaccept_invitees is enabled). However, the pending invitations warning message can still appear after that login, even though the invitation is no longer pending.

This appears to be caused by stale cached results from the invitation loader: the invitation status is updated to accepted, but the per-user invitation cache is not invalidated in this auto-accept flow.

I believe this has been introduced by https://www.drupal.org/project/ginvite/issues/3589074, which should be referenced as the likely source of the regression.

Steps to reproduce

  1. Enable pending invitation warning in ginvite.pending_invitations_warning.
  2. Configure group invitation plugin with autoaccept_invitees = TRUE.
  3. Ensure an existing active user has a pending group invitation (invitation_status = pending).
  4. Log in as that invited user.
  5. Observe the invitation is auto-accepted / membership is created and the warning message about pending invitations is still displayed.

Proposed resolution

Invalidate the invited user’s invitation cache immediately after auto-accept logic in the subscriber flow (autoAcceptGroupInvitation).

Issue fork ginvite-3593080

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

colinstillwell created an issue. See original summary.

colinstillwell’s picture

Merge request raised and patch attached.

colinstillwell’s picture

Status: Active » Needs review

lobsterr made their first commit to this issue’s fork.

lobsterr’s picture

Hi colinstillwell, thank you for your contribution, but I believe we need to use more general approach here and clean the cache when we add a member, there could be other places where user could be added in the code.

Please check my changes.