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(core): hide versions.* documents from search, update getPublishedId to account for versions #7470

Merged
merged 4 commits into from
Sep 20, 2024

Conversation

pedrobonamin
Copy link
Contributor

@pedrobonamin pedrobonamin commented Sep 5, 2024

Description

This PR adds changes to the studio search to not query for documents that start with the id versions.*
We need to exclude that the version documents from the search queries (lists and global search), so users won't see duplicated results if they have version documents.

This PR also updates how the getPublishedId function works, accounting for the version documents.
It has been decided that all documents in which the first segment is versions. will be considered a version document, the second segment is the versionId and the following segments are the document published id.
The update for the getPublishedId function handles this cases. See tests for this scenario

Now, when visiting a document in the URL with the id versions.foo.bar when the builder defines the document id inside the pane it will resolve to id=bar , so the user will be able to interact with the document.
E.g: visiting this document won't crash the studio after this changes:

What to review

Are this changes correct?

Testing

Added new tests for the updates in the draftUtils functions, search tests are also updated to follow the new rules

Notes for release

n/a not public facing yet

Copy link

vercel bot commented Sep 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 2:59pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 2:59pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 2:59pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 2:59pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 2:59pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Sep 20, 2024 2:59pm

Copy link
Contributor

github-actions bot commented Sep 5, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Sep 5, 2024

Component Testing Report Updated Sep 20, 2024 3:02 PM (UTC)

❌ Failed Tests (1) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 45s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 37s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 45s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 40s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 17s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 27s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ❌ Failed (Inspect) 46s 11 0 1
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

@pedrobonamin pedrobonamin marked this pull request as ready for review September 6, 2024 07:04
@pedrobonamin pedrobonamin requested review from a team as code owners September 6, 2024 07:04
@pedrobonamin pedrobonamin requested review from ricokahler and removed request for a team September 6, 2024 07:04
@ricokahler ricokahler requested a review from a team as a code owner September 6, 2024 21:30
@pedrobonamin pedrobonamin changed the title fix(core): hide versions.* documents from search and lists, show error in document panel fix(core): hide versions.* documents from search and lists, update getPublishedId to account for versions Sep 10, 2024
@pedrobonamin pedrobonamin changed the title fix(core): hide versions.* documents from search and lists, update getPublishedId to account for versions fix(core): hide versions.* documents from search, update getPublishedId to account for versions Sep 10, 2024
@pedrobonamin pedrobonamin removed the request for review from a team September 10, 2024 08:08
juice49
juice49 previously approved these changes Sep 20, 2024
Copy link
Contributor

@juice49 juice49 left a comment

Choose a reason for hiding this comment

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

Looks good to me! Added one tiny comment.

@pedrobonamin pedrobonamin added this pull request to the merge queue Sep 20, 2024
Merged via the queue into next with commit 7c814a8 Sep 20, 2024
42 checks passed
@pedrobonamin pedrobonamin deleted the corel-158 branch September 20, 2024 15:08
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