Repository navigation
Description
👟 Reproduction steps
- Self-hosted Appwrite 2.4.0. An observer subscribes to the
presenceschannel. - A signed-in user creates a presence over REST, as in the docs' heartbeat pattern:
PUT /v1/presences/{presenceId}withstatus: 'online',permissions: ['read("any")', 'update("user:<id>")', 'delete("user:<id>")']. - With an API key, block the user (
PATCH /v1/users/{id}/status→false) or delete the user (DELETE /v1/users/{id}). GET /v1/presences/{presenceId}and watch the observer.
👍 Expected behavior
Blocking or deleting a user removes their presences (and sends presences.*.delete), like their sessions, tokens, memberships and targets are removed.
👎 Actual Behavior
The presence stays readable (GET → 200, with status and metadata) and no delete event is sent, after blocking and even after deleting the user. It disappears only when expiresAt passes (15 minutes by default, up to 30 days if the client set it), and the expiry cleanup sends no event either. Reproduced 2 of 2 runs. A deleted user keeps showing as "online" to everyone who can read the presence.
Presences created over a realtime connection are not affected: blocking or deleting the user closes the connection, and onClose removes them.
Cause: Deletes::deleteUser() (src/Appwrite/Platform/Workers/Deletes.php) deletes sessions, keys, memberships, tokens, authenticators, challenges, identities and targets, but not presenceLogs; blocking the user does not touch presences at all.
🎲 Appwrite version
2.4.0
💻 Operating system
Linux (Debian 12), Docker
🧱 Your Environment
Self-hosted, Postgres adapter, two API/realtime nodes.
💡 Suggested fix
Delete the user's presences in deleteUser() and when the user is blocked, and trigger presences.*.delete for each, so subscribers update immediately.
👀 Have you spent some time to check if this issue has been raised before?
- I checked and didn't find a similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct
Activity