Skip to content

V16/new trash handling#802

Merged
KevinJump merged 8 commits into
v16/mainfrom
v16/new-trash-handling
Sep 19, 2025
Merged

V16/new trash handling#802
KevinJump merged 8 commits into
v16/mainfrom
v16/new-trash-handling

Conversation

@KevinJump

Copy link
Copy Markdown
Owner

fix for #799 - Trash does not correctly import on a clean site.

the change isn't massive, we were not handling the case where the item was trashed, but it was also imported first time - this means because we never hit the internal MoveToRecycleBin call, the item Trashed state was never set to true.

This change fixes that, and makes sure the delete relation is in place so the restore knows where the item goes back to in the site.

Move's trash handling to the second pass, because when creating the relation, you need the item to have an internal id (int) and that doesn't happen until it's been saved (in the first pass).

We have tidies up trash handling, so there is less duplication between the media and content serializers.

@KevinJump KevinJump requested a review from Copilot September 16, 2025 10:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes trash handling for imported items by moving trash processing to the second pass and consolidating duplicate code between media and content serializers. The fix addresses issue #799 where trashed items weren't correctly imported on clean sites.

  • Moves trash handling logic from first pass to second pass to ensure items have internal IDs for relation creation
  • Consolidates duplicate trash handling code into the base class with abstract methods for type-specific operations
  • Adds JSON converters for block layout items to handle obsolete properties causing false positives

Reviewed Changes

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

Show a summary per file
File Description
MediaSerializer.cs Removes first-pass trash handling and implements abstract methods for media-specific operations
ContentSerializer.cs Removes duplicate trash handling code and implements abstract methods for content-specific operations
ContentSerializerBase.cs Adds consolidated trash handling logic and abstract method definitions
JsonBlockItemConverters.cs New converters for consistent block layout item serialization
JsonTextExtensions.cs Registers the new block item converters
XElementJsonConverter.cs Adds trailing newline

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread uSync.Core/Serialization/Serializers/ContentSerializerBase.cs Outdated
Comment thread uSync.Core/Serialization/Serializers/ContentSerializerBase.cs Outdated
KevinJump and others added 3 commits September 16, 2025 11:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@KevinJump KevinJump merged commit 5db426a into v16/main Sep 19, 2025
1 check passed
@KevinJump KevinJump deleted the v16/new-trash-handling branch September 19, 2025 17:06
alexsee pushed a commit to alexsee/umbraco-container that referenced this pull request Sep 28, 2025
Updated [uSync](https://github.com/KevinJump/uSync) from 16.0.4 to
16.0.5.

<details>
<summary>Release notes</summary>

_Sourced from [uSync's
releases](https://github.com/KevinJump/uSync/releases)._

## 16.0.5

This is a patch release for uSync v16 for Umbraco v16 - it contains some
fixes to reported issues.

## What's Changed
* add missing translations for summary (over 1000) titles in report das…
by @​KevinJump in KevinJump/uSync#796
* add waiting state to the import upload button. by @​KevinJump in
KevinJump/uSync#797
* Fix #​800 Add blockItemConverters by @​KevinJump in
KevinJump/uSync#801
* V16/new trash handling by @​KevinJump in
KevinJump/uSync#802
* Fix - topological sort, - key not matching internally. by @​KevinJump
in KevinJump/uSync#803


**Full Changelog**:
KevinJump/uSync@v16.0.4...v16.0.5

Commits viewable in [compare
view](KevinJump/uSync@v16.0.4...v16.0.5).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=uSync&package-manager=nuget&previous-version=16.0.4&new-version=16.0.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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