Skip to content

Conversation

@madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented Oct 17, 2025

This PR sets a Document/Media to read-only when it is in the Recycle Bin.

With this PR, we now listen to the trash/restore client-side events and apply a read-only rule based on the state. Currently, the item retains its existing "Draft/Publish/etc." state. This PR also prepares the workspace to display the correct state when an item is trashed or restored.

We also still have an issue with the breadcrumb. That will be addressed in another PR.

Screen.Recording.2025-10-17.at.13.01.57.mov

Copilot AI review requested due to automatic review settings October 17, 2025 11:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Sets Documents and Media workspaces to read-only when the item is in the Recycle Bin, and keeps them up-to-date by listening to trash/restore action events.

  • Adds UmbEntityRestoredFromRecycleBinEvent and dispatches it after a successful restore.
  • Media and Document workspaces now subscribe to trash/restore events and toggle a read-only guard based on isTrashed; they also reload on relevant events.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Umbraco.Web.UI.Client/src/packages/media/media/workspace/media-workspace.context.ts Listens for trash/restore events, observes isTrashed, toggles read-only guard, and reloads when relevant events occur.
src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts Same as media workspace: event listeners, isTrashed observation, read-only guard toggle, and reload.
src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/restore-from-recycle-bin.event.ts Introduces UmbEntityRestoredFromRecycleBinEvent to signal restores.
src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/restore-from-recycle-bin.action.ts Dispatches UmbEntityRestoredFromRecycleBinEvent after restore; minor debug log present.
src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/index.ts Re-exports the new restore event.
src/Umbraco.Web.UI.Client/src/packages/core/recycle-bin/entity-action/index.ts Re-exports restore event alongside existing actions/events.

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

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

Works great in testing - all properties and features like rollback are disabled when the document or media is in the recycle bin.

Found a couple of small things (the second likely unrelated, but I'll note it).

  1. I can still click to choose a different template from the "Info" view for a document. The picker itself doesn't allow to choose anything, but probably I shouldn't be able to open the picker at all.

  2. There are a couple of "TODOs" appear in the media history when it's deleted.

image

@madsrasmussen
Copy link
Contributor Author

@AndyButland,

Great! I have fixed both the audit log to-dos and the content type and template pickers.

Could you give it another spin?

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

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

Sure, I've tested again and can confirm the two issues I raised are resolved.

@AndyButland AndyButland enabled auto-merge (squash) October 17, 2025 17:22
@AndyButland AndyButland merged commit 92dbaf7 into release/17.0 Oct 17, 2025
22 of 23 checks passed
@AndyButland AndyButland deleted the v17/hotfix/trashed-item-readonly branch October 17, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants