Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(admin/revision): duplicate ouuid put back deleted revision #955

Merged
merged 8 commits into from
Jul 12, 2024

Conversation

Davidmattei
Copy link
Member

@Davidmattei Davidmattei commented Jul 12, 2024

Q A
Bug fix? y
New feature? y
BC breaks? n
Deprecations? n
Fixed tickets? #891
Documentation? n

Situation:

  • Create a new document from UI (contentType ask OUUID), but the ouuid is a deleted revision
  • Create a new document from API (emsch:local:push), but the ouuid is a deleted revision

In both cases we should throw the DuplicatedOuuidException, but only if the revision is not deleted.
If the revision is deleted we put it back. see #891

@Davidmattei Davidmattei self-assigned this Jul 12, 2024
@Davidmattei Davidmattei added this to the 5.19.0 milestone Jul 12, 2024
@Davidmattei Davidmattei linked an issue Jul 12, 2024 that may be closed by this pull request
Also it only makes sense to lock the draft revision.
The other revisions will also be put back, but locking is not needed.
Will check the currentRevision and restore if needed.
The restored draft will be closed (endTime) and draft discard.
Because if we work with a single ouuid, the putBack method will return the current revision as a new draft.
@Davidmattei Davidmattei marked this pull request as ready for review July 12, 2024 17:23
@Davidmattei Davidmattei requested a review from a team as a code owner July 12, 2024 17:23
@@ -45,20 +45,20 @@ public function createAction(?string $ouuid, string $name, Request $request): Re
$this->dataService->refresh($newRevision->giveContentType()->giveEnvironment());
}
} catch (\Exception $e) {
if (($e instanceof NotFoundHttpException) or ($e instanceof BadRequestHttpException)) {
Copy link
Member

Choose a reason for hiding this comment

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

WTF "or". Good catch

Copy link
Member Author

Choose a reason for hiding this comment

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

We have more :) but will not do in this PR

@Davidmattei Davidmattei merged commit bf017ad into ems-project:5.x Jul 12, 2024
2 checks passed
@Davidmattei Davidmattei changed the title fix(core/revision): duplicate ouuid put back deleted revision fix(admin/revision): duplicate ouuid put back deleted revision Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Duplicate ouuid, should check trash revision and put it back
2 participants