fix: Do not copy edit path from headers
chore: Rename url -> path in routeHelpers closes #5229
This commit is contained in:
@@ -44,17 +44,17 @@ export function groupSettingsPath(): string {
|
||||
}
|
||||
|
||||
export function commentPath(document: Document, comment: Comment): string {
|
||||
return `${documentUrl(document)}?commentId=${comment.id}`;
|
||||
return `${documentPath(document)}?commentId=${comment.id}`;
|
||||
}
|
||||
|
||||
export function collectionUrl(url: string, section?: string): string {
|
||||
export function collectionPath(url: string, section?: string): string {
|
||||
if (section) {
|
||||
return `${url}/${section}`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
export function updateCollectionUrl(
|
||||
export function updateCollectionPath(
|
||||
oldUrl: string,
|
||||
collection: Collection
|
||||
): string {
|
||||
@@ -65,19 +65,22 @@ export function updateCollectionUrl(
|
||||
);
|
||||
}
|
||||
|
||||
export function documentUrl(doc: Document): string {
|
||||
export function documentPath(doc: Document): string {
|
||||
return doc.url;
|
||||
}
|
||||
|
||||
export function editDocumentUrl(doc: Document): string {
|
||||
export function documentEditPath(doc: Document): string {
|
||||
return `${doc.url}/edit`;
|
||||
}
|
||||
|
||||
export function documentInsightsUrl(doc: Document): string {
|
||||
export function documentInsightsPath(doc: Document): string {
|
||||
return `${doc.url}/insights`;
|
||||
}
|
||||
|
||||
export function documentHistoryUrl(doc: Document, revisionId?: string): string {
|
||||
export function documentHistoryPath(
|
||||
doc: Document,
|
||||
revisionId?: string
|
||||
): string {
|
||||
let base = `${doc.url}/history`;
|
||||
if (revisionId) {
|
||||
base += `/${revisionId}`;
|
||||
@@ -89,7 +92,7 @@ export function documentHistoryUrl(doc: Document, revisionId?: string): string {
|
||||
* Replace full url's document part with the new one in case
|
||||
* the document slug has been updated
|
||||
*/
|
||||
export function updateDocumentUrl(oldUrl: string, document: Document): string {
|
||||
export function updateDocumentPath(oldUrl: string, document: Document): string {
|
||||
// Update url to match the current one
|
||||
return oldUrl.replace(
|
||||
new RegExp("/doc/([0-9a-zA-Z-_~]*-[a-zA-z0-9]{10,15})"),
|
||||
@@ -132,10 +135,6 @@ export function sharedDocumentPath(shareId: string, docPath?: string) {
|
||||
return docPath ? `/s/${shareId}${docPath}` : `/s/${shareId}`;
|
||||
}
|
||||
|
||||
export function notFoundUrl(): string {
|
||||
return "/404";
|
||||
}
|
||||
|
||||
export function urlify(path: string): string {
|
||||
return `${window.location.host}${path}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user