Skip to content

fix(realtime): deliver membership delete event to removed member - #13780

Merged
HarshMN2345 merged 2 commits into
appwrite:cursor/membership-realtime-delete-98fafrom
ItsRoy69:fix/realtime-membership-delete-event-13768
Oct 12, 2026
Merged

HarshMN2345 merged 2 commits into
appwrite:cursor/membership-realtime-delete-98fafrom
ItsRoy69:fix/realtime-membership-delete-event-13768

Conversation

@ItsRoy69

Copy link
Copy Markdown
Contributor

What does this PR do?

Real-time subscribers who were removed from a team never received the teams.{teamId}.memberships.{membershipId}.delete event. The pubsub handler in app/realtime.php rebuilt the affected user's roles (revoking their team:{teamId} role) before computing receivers, so the very member being removed was filtered out of the fan-out.

The handler now computes receivers against the current subscription tree first, so the removed member still matches while their team role is being revoked. A post-rebuild fan-out is merged in afterwards so membership create events still reach the newly added member.

Test Plan

  • New e2e testChannelMembershipsDelete (tests/e2e/Services/Realtime/RealtimeCustomClientTest.php) a fresh user subscribes to memberships, an admin creates a team + membership (create event received), then deletes the membership (delete event still received on the removed member's connection).
  • tests/unit/Messaging: 39 tests pass.
  • composer lint (Pint) and PHPStan level 4 clean on both changed files.

Related PRs and Issues

Checklist

  • Read the Contributing Guidelines on issues
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness, security, or repository-rule violations.

Summary

The PR preserves the pre-rebuild receiver set so a removed team member receives the membership deletion event, while retaining a post-rebuild scan for events that may grant access.

  • Captures matching subscribers before permission-driven subscription rebuilding.
  • Skips the redundant post-rebuild subscription scan for deletion events.
  • Adds an end-to-end test covering membership creation and deletion delivery to the affected user.

Reviews (2) · Last reviewed commit: "fix(realtime): skip redundant post-rebui..."

Comment thread app/realtime.php Resolved
@HarshMN2345
HarshMN2345 changed the base branch from main to cursor/membership-realtime-delete-98fa October 12, 2026 08:02
@HarshMN2345
HarshMN2345 merged commit ecbae14 into appwrite:cursor/membership-realtime-delete-98fa Oct 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Membership realtime delete event not properly firing on client sdks

2 participants