Skip to content

Resolve double-entry behavior in post editor rooms #134

Description

@josephfusco

When a user opens a post editor, two presence entries are written to the same post room:

  • editor-{user_id} by the editor heartbeat handler (includes/heartbeat.php:108-116)
  • lock-{user_id} by the post-lock bridge (includes/post-lock-bridge.php:49-56)

Both store identical data: same room, same user, same { action: 'editing', screen: ... }. They differ only in the client_id prefix. wp_get_presence() returns both, undocumented, with no way to tell them apart except by parsing that prefix.

The one signal the split encodes is post-lock liveness, since the two rows are refreshed by different heartbeat keys and age out independently.

Proposed fix

Merge into one editor-{user_id} entry with a locked boolean in the state data. The bridge writes into the existing entry instead of creating a row.

Knock-ons:

If rejected

#21 is a live bug, PR #78 is its fix and should be unblocked. This issue then narrows to adding an explicit type field so callers stop parsing client_id.

Sequencing

#135 moves this same inline script to a file. Land it after this and PR #78.

Metadata

Metadata

Labels

Needs DiscussionAnything that needs a discussion/agreement[Area] HeartbeatIssues for the heartbeat subsystem[Area] Post Lock BridgeIssues for the post-lock bridge[Type] BugAn existing feature is broken

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions