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
- Enable pending invitation warning in
ginvite.pending_invitations_warning. - Configure group invitation plugin with
autoaccept_invitees = TRUE. - Ensure an existing active user has a pending group invitation (
invitation_status = pending). - Log in as that invited user.
- 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).
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3593080-ginvite-autoaccept-cache-invalidation-3.patch | 932 bytes | colinstillwell |
Issue fork ginvite-3593080
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
Comment #3
colinstillwell commentedMerge request raised and patch attached.
Comment #4
colinstillwell commentedComment #6
lobsterr commentedHi 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.