Skip to content

fix: clear a user's presence when their account or site membership ends - #339

Merged
josephfusco merged 3 commits into
WordPress:feature/network-presence-screenfrom
i-am-chitti:fix/327-delete-user-presence-cleanup
Aug 24, 2026
Merged

fix: clear a user's presence when their account or site membership ends#339
josephfusco merged 3 commits into
WordPress:feature/network-presence-screenfrom
i-am-chitti:fix/327-delete-user-presence-cleanup

Conversation

@i-am-chitti

Copy link
Copy Markdown
Collaborator

Description

Fixes #327

Hooks deleted_user and remove_user_from_blog to clear a user's presence immediately instead of leaving rows to age out on TTL. Re-pushing the network summary falls out for free — wp_remove_user_presence() already fires the change signal the push is wired to.

Testing

  • Added unit tests for both hooks in isolation, plus an integration test covering wpmu_delete_user() clearing presence across every site a user belonged to.
  • Updated two existing tests (post list, REST controller) that had relied on a deleted user's row surviving deletion to exercise their own fallback-rendering paths.
Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Implementation and tests

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props iamchitti, joefusco.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown
Contributor

▶ Preview in WordPress Playground

Open in WordPress Playground

Boots a fresh WordPress with this PR's presence-api build, seeds 5 demo users, and drops you on the dashboard.

Stress-test variant: 40 demo users · Built from 963998ce493d74f7af9bd9628539de0ae0aa616a. Auto-updates when you push.

@i-am-chitti i-am-chitti self-assigned this Aug 24, 2026
@josephfusco

josephfusco commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Base branch is gone. #299 and #313 were closed today and replaced by a stack, #332 through #337, so feature/network-presence-screen will never merge.

Retarget to main. Your commits cherry-pick clean apart from one test in tests/test-network-presence.php, which the restructure split into four files. That test asserts the re-push, so it belongs in tests/test-network-summary-push.php on #333, where it passes unchanged.

#328 has the same base problem; note on the issue.

@josephfusco josephfusco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Thanks for adding!

@josephfusco
josephfusco merged commit 37bb342 into WordPress:feature/network-presence-screen Aug 24, 2026
4 checks 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.

2 participants