Skip to content

Desktop files: Cascade-trash comment shortcuts when a comment is trashed - #1013

Open
CookieDarb wants to merge 1 commit into
WordPress:trunkfrom
CookieDarb:feat/comment-placement-cascade-cleanup
Open

CookieDarb wants to merge 1 commit into
WordPress:trunkfrom
CookieDarb:feat/comment-placement-cascade-cleanup

Conversation

@CookieDarb

@CookieDarb CookieDarb commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #1012

Fixes the bug where comment shortcuts placed on the desktop wallpaper remain visible on the desktop instead of being moved to the Recycle Bin when the comment is trashed.

Why?

Desktop shortcuts for entities (posts, attachments, users) automatically cascade-trash their placements when the underlying entity is removed or moved to the trash. Comments had a registered desktop file type (OpenStation_Comment_File), but cascade-cleanup.php lacked hooks for comments. As a result, trashing a comment left its desktop shortcut active on the wallpaper, and the shortcut was never routed to the Recycle Bin.

How?

  • includes/desktop-files/cascade-cleanup.php:
    • Added openstation_files_cascade_on_comment_trash( $comment_id ) to soft-trash placement rows where file_type='comment'.
    • Hooked WordPress Core's trashed_comment and deleted_comment actions to cascade comment trashing and permanent deletions to their desktop shortcuts.
  • tests/phpunit/tests/desktopFilesCascadeCleanup.php:
    • Added test_wp_trash_comment_triggers_cascade() to assert that calling wp_trash_comment() soft-trashes matching comment placements.
    • Added test_delete_comment_triggers_cascade() to assert that calling wp_delete_comment() soft-trashes matching comment placements.

Testing Instructions

  1. Place a comment shortcut onto the desktop wallpaper.
  2. Move the comment to the Trash.
  3. Return to the desktop wallpaper and verify that the comment shortcut is no longer on the active desktop.
  4. Open the Recycle Bin app and check the Desktop list to confirm the comment shortcut was moved there.

Screencast

after-comment-cascase.mov

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Adding tests and refining documentations.

Open WordPress Playground Preview

@CookieDarb CookieDarb changed the title Desktop files: Cascase-trash comment shortcuts when a comment is trashed Desktop files: Cascade-trash comment shortcuts when a comment is trashed Oct 14, 2026
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.

Comment desktop shortcuts are not trashed when comment is trashed

1 participant