-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Set doc slug on importing collections #7270
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
Conversation
server/queues/tasks/ImportTask.ts
Outdated
} | ||
} | ||
|
||
doc.urlId = generateDocUrlId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The chances of a collision with {slugifiedTitle}-{urlId}
should be relatively low within a single machine.
To make it more resilient, retry can be added here; but I think it might be an overkill.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the chances of collision are 1 in ~70millon, I can live with that
https://www.wolframalpha.com/input?i=1%2F2%2Bsqrt%281%2F4-2*%2836%5E10%29*ln%280.5%29%29
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The collision chances are 1 in ~1 billion, I believe (62 characters instead of 36).
https://www.wolframalpha.com/input?i=1%2F2+%2B+sqrt%281%2F4+%2B+2*%2862%5E10%29*ln%282%29%29
The actual collisions that we're worried about ({title}-{urlId}) will be even lower than urlId
on its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, great improvement and also avoids a redirect when navigating to these imported documents
…7790c by renovate (#25953) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [outlinewiki/outline](https://redirect.github.com/outline/outline) | minor | `0.78.0` -> `0.79.0` | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>outline/outline (outlinewiki/outline)</summary> ### [`v0.79.0`](https://redirect.github.com/outline/outline/releases/tag/v0.79.0) [Compare Source](https://redirect.github.com/outline/outline/compare/v0.78.0...v0.79.0) #### What's Changed ##### Group document membership It is now possible to add groups directly to documents, all members of the group will receive access to the document with the chosen permissions. Use this to share portions of a larger private collection with a mix of stakeholders. Groups appear as a new sharing option in the existing `Share` button. ##### Other improvements - Add support to embed any webpage with `/embed` command by [@​Blendman974](https://redirect.github.com/Blendman974) in [https://github.com/outline/outline/pull/7319](https://redirect.github.com/outline/outline/pull/7319) - Add support for Dropbox embed by [@​LouisKottmann](https://redirect.github.com/LouisKottmann) in [https://github.com/outline/outline/pull/7299](https://redirect.github.com/outline/outline/pull/7299) - Add support for workspace templates by [@​hmacr](https://redirect.github.com/hmacr) in [https://github.com/outline/outline/pull/7150](https://redirect.github.com/outline/outline/pull/7150) - Added `R` language highlighting in code blocks [https://github.com/outline/outline/issues/7473](https://redirect.github.com/outline/outline/issues/7473) - New and improved translations - Shared and read-only documents can now be dragged to "Starred" in [https://github.com/outline/outline/pull/7506](https://redirect.github.com/outline/outline/pull/7506) - Outgoing emails now include headers to enhance threading in inbox by [@​hmacr](https://redirect.github.com/hmacr) in [https://github.com/outline/outline/pull/7477](https://redirect.github.com/outline/outline/pull/7477) - Inserting `/time` and `/datetime` in templates will now insert a template variable - Allowed `shift+enter` to insert a soft break in comments [#​7451](https://redirect.github.com/outline/outline/issues/7451) - Audio and video files are now served with `inline` content disposition so they display in browser - Space characters are now allowed when filtering `@mention` - Added an option to clear an existing text highlight in the editor - The `e` shortcut now refocuses the editor if unfocused - `Shift-Ctrl-c` added as editor shortcut for toggling code blocks ##### Fixes - Emojis in headings are now correctly included in the table of contents - Added a missing error toast when importing a document fails - Escape key with suggestion menu open no longer unfocuses editor - Improved markdown detection of tables with alignment characters in header - Comment marks are now correctly removed when a document is duplicated [https://github.com/outline/outline/issues/7390](https://redirect.github.com/outline/outline/issues/7390) - Fixed flashing of document header with many live collaborators [https://github.com/outline/outline/issues/7400](https://redirect.github.com/outline/outline/issues/7400) - Fixed toolbar positioning issues on Android [https://github.com/outline/outline/issues/7052](https://redirect.github.com/outline/outline/issues/7052) - Fixed error when passed too many user invites by [@​bkrausz](https://redirect.github.com/bkrausz) in [https://github.com/outline/outline/pull/7282](https://redirect.github.com/outline/outline/pull/7282) - Fixed several issues with importing collections by [@​hmacr](https://redirect.github.com/hmacr) in [https://github.com/outline/outline/pull/7270](https://redirect.github.com/outline/outline/pull/7270) - Fixed an issue where collection index calculation does not take into account user scope [https://github.com/outline/outline/pull/7294](https://redirect.github.com/outline/outline/pull/7294) - Fixed error in `DeliverWebhookTask` when trash is emptied by [@​apoorv-mishra](https://redirect.github.com/apoorv-mishra) in [https://github.com/outline/outline/pull/7304](https://redirect.github.com/outline/outline/pull/7304) - Fixed a possibility that document title changes are not saved on navigation in [https://github.com/outline/outline/pull/7293](https://redirect.github.com/outline/outline/pull/7293) - Added protection against pasting invalid `@mentions` - Trashed documents no longer appear in "Shared with me" - Fixed an internal server error when search query contains a `:` [https://github.com/outline/outline/issues/7481](https://redirect.github.com/outline/outline/issues/7481) - Fixed backwards icon asset naming by [@​bkrausz](https://redirect.github.com/bkrausz) in [https://github.com/outline/outline/pull/7327](https://redirect.github.com/outline/outline/pull/7327) - Share dialog is now scrollable again by [@​apoorv-mishra](https://redirect.github.com/apoorv-mishra) in [https://github.com/outline/outline/pull/7344](https://redirect.github.com/outline/outline/pull/7344) - Fixed an issue where collections are not loaded if collapsed in sidebar by [@​apoorv-mishra](https://redirect.github.com/apoorv-mishra) in [https://github.com/outline/outline/pull/7358](https://redirect.github.com/outline/outline/pull/7358) - Fixed internal links copied in publicly shared documents are incorrect in [https://github.com/outline/outline/pull/7368](https://redirect.github.com/outline/outline/pull/7368) - Fixed an issue in latest Chrome that causes editor elements to become unscrollable in [https://github.com/outline/outline/pull/7394](https://redirect.github.com/outline/outline/pull/7394) - Fixed problems viewing comments past first 25 in [https://github.com/outline/outline/pull/7397](https://redirect.github.com/outline/outline/pull/7397) - Improved performance when editing the document title - Improved performance with missing indexes in [https://github.com/outline/outline/pull/7425](https://redirect.github.com/outline/outline/pull/7425) - Improved performance by avoiding count query in search where possible in [https://github.com/outline/outline/pull/7426](https://redirect.github.com/outline/outline/pull/7426) - Fixed logic for post-login redirect in [https://github.com/outline/outline/pull/7428](https://redirect.github.com/outline/outline/pull/7428) - Fixed an issue where quotes in code are replaced with smart quotes in [https://github.com/outline/outline/pull/7450](https://redirect.github.com/outline/outline/pull/7450) - Fixed an issue with for OIDC logout logic by [@​blib](https://redirect.github.com/blib) in [https://github.com/outline/outline/pull/7446](https://redirect.github.com/outline/outline/pull/7446) - Fixed port is now considered for whether a link is internal in [https://github.com/outline/outline/pull/7529](https://redirect.github.com/outline/outline/pull/7529) - Fixed healthcheck in self-hosted docker image - Fixed code blocks do not scroll automatically when using beginning and end of line shortcuts - Improved performance by increasing concurrency on worker - Pasting onto a placeholder now replaces the placeholder [https://github.com/outline/outline/issues/7346](https://redirect.github.com/outline/outline/issues/7346) - An error when searching no longer displays the previous results [https://github.com/outline/outline/issues/7437](https://redirect.github.com/outline/outline/issues/7437) #### New Contributors - [@​LouisKottmann](https://redirect.github.com/LouisKottmann) made their first contribution in [https://github.com/outline/outline/pull/7299](https://redirect.github.com/outline/outline/pull/7299) - [@​DiamondYuan](https://redirect.github.com/DiamondYuan) made their first contribution in [https://github.com/outline/outline/pull/7411](https://redirect.github.com/outline/outline/pull/7411) - [@​Blendman974](https://redirect.github.com/Blendman974) made their first contribution in [https://github.com/outline/outline/pull/7319](https://redirect.github.com/outline/outline/pull/7319) - [@​blib](https://redirect.github.com/blib) made their first contribution in [https://github.com/outline/outline/pull/7446](https://redirect.github.com/outline/outline/pull/7446) **Full Changelog**: outline/outline@v0.78.0...v0.79.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://redirect.github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC42Ny41IiwidXBkYXRlZEluVmVyIjoiMzguNjcuNSIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6WyJhdXRvbWVyZ2UiLCJ1cGRhdGUvZG9ja2VyL2dlbmVyYWwvbm9uLW1ham9yIl19-->
This PR removes the
doc/{docId}
format and sets the doc slug when collections are imported.Documents which use
doc/{docId}
to link other documents do not have these references replaced with relative URLs when exported. This PR fixes this as well.Bug mentioned here
Related #7259